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_MMAL] = {
1978  .name = "mmal",
1979  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1980  },
1981  [AV_PIX_FMT_CUDA] = {
1982  .name = "cuda",
1983  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1984  },
1985  [AV_PIX_FMT_AYUV64LE] = {
1986  .name = "ayuv64le",
1987  .nb_components = 4,
1988  .log2_chroma_w = 0,
1989  .log2_chroma_h = 0,
1990  .comp = {
1991  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
1992  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
1993  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
1994  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
1995  },
1996  .flags = AV_PIX_FMT_FLAG_ALPHA,
1997  },
1998  [AV_PIX_FMT_AYUV64BE] = {
1999  .name = "ayuv64be",
2000  .nb_components = 4,
2001  .log2_chroma_w = 0,
2002  .log2_chroma_h = 0,
2003  .comp = {
2004  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2005  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2006  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2007  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2008  },
2010  },
2011  [AV_PIX_FMT_P010LE] = {
2012  .name = "p010le",
2013  .nb_components = 3,
2014  .log2_chroma_w = 1,
2015  .log2_chroma_h = 1,
2016  .comp = {
2017  { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2018  { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2019  { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2020  },
2021  .flags = AV_PIX_FMT_FLAG_PLANAR,
2022  },
2023  [AV_PIX_FMT_P010BE] = {
2024  .name = "p010be",
2025  .nb_components = 3,
2026  .log2_chroma_w = 1,
2027  .log2_chroma_h = 1,
2028  .comp = {
2029  { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2030  { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2031  { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2032  },
2034  },
2035  [AV_PIX_FMT_GBRAP12LE] = {
2036  .name = "gbrap12le",
2037  .nb_components = 4,
2038  .log2_chroma_w = 0,
2039  .log2_chroma_h = 0,
2040  .comp = {
2041  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2042  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2043  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2044  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2045  },
2048  },
2049  [AV_PIX_FMT_GBRAP12BE] = {
2050  .name = "gbrap12be",
2051  .nb_components = 4,
2052  .log2_chroma_w = 0,
2053  .log2_chroma_h = 0,
2054  .comp = {
2055  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2056  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2057  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2058  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2059  },
2062  },
2063  [AV_PIX_FMT_GBRAP10LE] = {
2064  .name = "gbrap10le",
2065  .nb_components = 4,
2066  .log2_chroma_w = 0,
2067  .log2_chroma_h = 0,
2068  .comp = {
2069  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2070  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2071  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2072  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2073  },
2076  },
2077  [AV_PIX_FMT_GBRAP10BE] = {
2078  .name = "gbrap10be",
2079  .nb_components = 4,
2080  .log2_chroma_w = 0,
2081  .log2_chroma_h = 0,
2082  .comp = {
2083  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2084  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2085  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2086  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2087  },
2090  },
2091 };
2092 #if FF_API_PLUS1_MINUS1
2094 #endif
2095 
2096 static const char *color_range_names[AVCOL_RANGE_NB] = {
2097  "unknown", "tv", "pc",
2098 };
2099 
2100 static const char *color_primaries_names[AVCOL_PRI_NB] = {
2101  "reserved", "bt709", "unknown", "reserved", "bt470m",
2102  "bt470bg", "smpte170m", "smpte240m", "film", "bt2020",
2103  "smpte428-1",
2104 };
2105 
2106 static const char *color_transfer_names[AVCOL_TRC_NB] = {
2107  "reserved", "bt709", "unknown", "reserved", "bt470m",
2108  "bt470bg", "smpte170m", "smpte240m", "linear", "log100",
2109  "log316", "iec61966-2-4", "bt1361e", "iec61966-2-1",
2110  "bt2020-10", "bt2020-20", "smpte2084", "smpte428-1",
2111  "arib-std-b67"
2112 };
2113 
2114 static const char *color_space_names[AVCOL_SPC_NB] = {
2115  "gbr", "bt709", "unknown", "reserved", "fcc",
2116  "bt470bg", "smpte170m", "smpte240m", "ycgco",
2117  "bt2020nc", "bt2020c",
2118 };
2119 
2121  "unspecified", "left", "center", "topleft",
2122  "top", "bottomleft", "bottom",
2123 };
2124 
2125 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
2126 {
2127  enum AVPixelFormat pix_fmt;
2128 
2129  for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
2130  if (av_pix_fmt_descriptors[pix_fmt].name &&
2131  (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
2132  av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
2133  return pix_fmt;
2134 
2135  return AV_PIX_FMT_NONE;
2136 }
2137 
2139 {
2140  return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
2141  av_pix_fmt_descriptors[pix_fmt].name : NULL;
2142 }
2143 
2144 #if HAVE_BIGENDIAN
2145 # define X_NE(be, le) be
2146 #else
2147 # define X_NE(be, le) le
2148 #endif
2149 
2151 {
2152  enum AVPixelFormat pix_fmt;
2153 
2154  if (!strcmp(name, "rgb32"))
2155  name = X_NE("argb", "bgra");
2156  else if (!strcmp(name, "bgr32"))
2157  name = X_NE("abgr", "rgba");
2158 
2159  pix_fmt = get_pix_fmt_internal(name);
2160  if (pix_fmt == AV_PIX_FMT_NONE) {
2161  char name2[32];
2162 
2163  snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
2164  pix_fmt = get_pix_fmt_internal(name2);
2165  }
2166 
2167 #if FF_API_VAAPI
2168  if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
2169  pix_fmt = AV_PIX_FMT_VAAPI;
2170 #endif
2171  return pix_fmt;
2172 }
2173 
2175 {
2176  int c, bits = 0;
2177  int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2178 
2179  for (c = 0; c < pixdesc->nb_components; c++) {
2180  int s = c == 1 || c == 2 ? 0 : log2_pixels;
2181  bits += pixdesc->comp[c].depth << s;
2182  }
2183 
2184  return bits >> log2_pixels;
2185 }
2186 
2188 {
2189  int c, bits = 0;
2190  int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2191  int steps[4] = {0};
2192 
2193  for (c = 0; c < pixdesc->nb_components; c++) {
2194  const AVComponentDescriptor *comp = &pixdesc->comp[c];
2195  int s = c == 1 || c == 2 ? 0 : log2_pixels;
2196  steps[comp->plane] = comp->step << s;
2197  }
2198  for (c = 0; c < 4; c++)
2199  bits += steps[c];
2200 
2201  if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
2202  bits *= 8;
2203 
2204  return bits >> log2_pixels;
2205 }
2206 
2207 char *av_get_pix_fmt_string(char *buf, int buf_size,
2208  enum AVPixelFormat pix_fmt)
2209 {
2210  /* print header */
2211  if (pix_fmt < 0) {
2212  snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
2213  } else {
2214  const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
2215  snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
2216  pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
2217  }
2218 
2219  return buf;
2220 }
2221 
2223 {
2224  if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
2225  return NULL;
2226  return &av_pix_fmt_descriptors[pix_fmt];
2227 }
2228 
2230 {
2231  if (!prev)
2232  return &av_pix_fmt_descriptors[0];
2233  while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
2234  prev++;
2235  if (prev->name)
2236  return prev;
2237  }
2238  return NULL;
2239 }
2240 
2242 {
2243  if (desc < av_pix_fmt_descriptors ||
2244  desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
2245  return AV_PIX_FMT_NONE;
2246 
2247  return desc - av_pix_fmt_descriptors;
2248 }
2249 
2251  int *h_shift, int *v_shift)
2252 {
2253  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2254  if (!desc)
2255  return AVERROR(ENOSYS);
2256  *h_shift = desc->log2_chroma_w;
2257  *v_shift = desc->log2_chroma_h;
2258 
2259  return 0;
2260 }
2261 
2263 {
2264  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2265  int i, planes[4] = { 0 }, ret = 0;
2266 
2267  if (!desc)
2268  return AVERROR(EINVAL);
2269 
2270  for (i = 0; i < desc->nb_components; i++)
2271  planes[desc->comp[i].plane] = 1;
2272  for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
2273  ret += planes[i];
2274  return ret;
2275 }
2276 
2278  int i, j;
2279 
2280  for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
2281  const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
2282  uint8_t fill[4][8+6+3] = {{0}};
2283  uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
2284  int linesize[4] = {0,0,0,0};
2285  uint16_t tmp[2];
2286 
2287  if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
2288  continue;
2289 // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
2290  av_assert0(d->log2_chroma_w <= 3);
2291  av_assert0(d->log2_chroma_h <= 3);
2292  av_assert0(d->nb_components <= 4);
2293  av_assert0(d->name && d->name[0]);
2294  av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & AV_PIX_FMT_FLAG_ALPHA));
2295  av_assert2(av_get_pix_fmt(d->name) == i);
2296 
2297  for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
2298  const AVComponentDescriptor *c = &d->comp[j];
2299  if(j>=d->nb_components) {
2300  av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
2301  continue;
2302  }
2303  if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
2304  av_assert0(c->step >= c->depth);
2305  } else {
2306  av_assert0(8*c->step >= c->depth);
2307  }
2308  if (!strncmp(d->name, "bayer_", 6))
2309  continue;
2310  av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
2311  av_assert0(tmp[0] == 0 && tmp[1] == 0);
2312  tmp[0] = tmp[1] = (1<<c->depth) - 1;
2313  av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
2314  }
2315  }
2316 }
2317 
2318 
2320 {
2321  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2322  char name[16];
2323  int i;
2324 
2325  if (!desc || strlen(desc->name) < 2)
2326  return AV_PIX_FMT_NONE;
2327  av_strlcpy(name, desc->name, sizeof(name));
2328  i = strlen(name) - 2;
2329  if (strcmp(name + i, "be") && strcmp(name + i, "le"))
2330  return AV_PIX_FMT_NONE;
2331 
2332  name[i] ^= 'b' ^ 'l';
2333 
2334  return get_pix_fmt_internal(name);
2335 }
2336 
2337 #define FF_COLOR_NA -1
2338 #define FF_COLOR_RGB 0 /**< RGB color space */
2339 #define FF_COLOR_GRAY 1 /**< gray color space */
2340 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
2341 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
2342 #define FF_COLOR_XYZ 4
2343 
2344 #define pixdesc_has_alpha(pixdesc) \
2345  ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL)
2346 
2347 
2349  if (desc->flags & AV_PIX_FMT_FLAG_PAL)
2350  return FF_COLOR_RGB;
2351 
2352  if(desc->nb_components == 1 || desc->nb_components == 2)
2353  return FF_COLOR_GRAY;
2354 
2355  if(desc->name && !strncmp(desc->name, "yuvj", 4))
2356  return FF_COLOR_YUV_JPEG;
2357 
2358  if(desc->name && !strncmp(desc->name, "xyz", 3))
2359  return FF_COLOR_XYZ;
2360 
2361  if(desc->flags & AV_PIX_FMT_FLAG_RGB)
2362  return FF_COLOR_RGB;
2363 
2364  if(desc->nb_components == 0)
2365  return FF_COLOR_NA;
2366 
2367  return FF_COLOR_YUV;
2368 }
2369 
2370 static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
2371 {
2372  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2373  int i;
2374 
2375  if (!desc || !desc->nb_components) {
2376  *min = *max = 0;
2377  return AVERROR(EINVAL);
2378  }
2379 
2380  *min = INT_MAX, *max = -INT_MAX;
2381  for (i = 0; i < desc->nb_components; i++) {
2382  *min = FFMIN(desc->comp[i].depth, *min);
2383  *max = FFMAX(desc->comp[i].depth, *max);
2384  }
2385  return 0;
2386 }
2387 
2388 static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
2389  enum AVPixelFormat src_pix_fmt,
2390  unsigned *lossp, unsigned consider)
2391 {
2392  const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
2393  const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
2394  int src_color, dst_color;
2395  int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
2396  int ret, loss, i, nb_components;
2397  int score = INT_MAX - 1;
2398 
2399  if (dst_pix_fmt >= AV_PIX_FMT_NB || dst_pix_fmt <= AV_PIX_FMT_NONE)
2400  return ~0;
2401 
2402  /* compute loss */
2403  *lossp = loss = 0;
2404 
2405  if (dst_pix_fmt == src_pix_fmt)
2406  return INT_MAX;
2407 
2408  if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
2409  return ret;
2410  if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
2411  return ret;
2412 
2413  src_color = get_color_type(src_desc);
2414  dst_color = get_color_type(dst_desc);
2415  if (dst_pix_fmt == AV_PIX_FMT_PAL8)
2416  nb_components = FFMIN(src_desc->nb_components, 4);
2417  else
2418  nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
2419 
2420  for (i = 0; i < nb_components; i++) {
2421  int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
2422  if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
2423  loss |= FF_LOSS_DEPTH;
2424  score -= 65536 >> depth_minus1;
2425  }
2426  }
2427 
2428  if (consider & FF_LOSS_RESOLUTION) {
2429  if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
2430  loss |= FF_LOSS_RESOLUTION;
2431  score -= 256 << dst_desc->log2_chroma_w;
2432  }
2433  if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
2434  loss |= FF_LOSS_RESOLUTION;
2435  score -= 256 << dst_desc->log2_chroma_h;
2436  }
2437  // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
2438  if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
2439  dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
2440  score += 512;
2441  }
2442  }
2443 
2444  if(consider & FF_LOSS_COLORSPACE)
2445  switch(dst_color) {
2446  case FF_COLOR_RGB:
2447  if (src_color != FF_COLOR_RGB &&
2448  src_color != FF_COLOR_GRAY)
2449  loss |= FF_LOSS_COLORSPACE;
2450  break;
2451  case FF_COLOR_GRAY:
2452  if (src_color != FF_COLOR_GRAY)
2453  loss |= FF_LOSS_COLORSPACE;
2454  break;
2455  case FF_COLOR_YUV:
2456  if (src_color != FF_COLOR_YUV)
2457  loss |= FF_LOSS_COLORSPACE;
2458  break;
2459  case FF_COLOR_YUV_JPEG:
2460  if (src_color != FF_COLOR_YUV_JPEG &&
2461  src_color != FF_COLOR_YUV &&
2462  src_color != FF_COLOR_GRAY)
2463  loss |= FF_LOSS_COLORSPACE;
2464  break;
2465  default:
2466  /* fail safe test */
2467  if (src_color != dst_color)
2468  loss |= FF_LOSS_COLORSPACE;
2469  break;
2470  }
2471  if(loss & FF_LOSS_COLORSPACE)
2472  score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
2473 
2474  if (dst_color == FF_COLOR_GRAY &&
2475  src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
2476  loss |= FF_LOSS_CHROMA;
2477  score -= 2 * 65536;
2478  }
2479  if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
2480  loss |= FF_LOSS_ALPHA;
2481  score -= 65536;
2482  }
2483  if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
2484  (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
2485  loss |= FF_LOSS_COLORQUANT;
2486  score -= 65536;
2487  }
2488 
2489  *lossp = loss;
2490  return score;
2491 }
2492 
2493 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
2494  enum AVPixelFormat src_pix_fmt,
2495  int has_alpha)
2496 {
2497  int loss;
2498  int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
2499  if (ret < 0)
2500  return ret;
2501  return loss;
2502 }
2503 
2504 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
2505  enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
2506 {
2507  enum AVPixelFormat dst_pix_fmt;
2508  int loss1, loss2, loss_mask;
2509  const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
2510  const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
2511  int score1, score2;
2512 
2513  loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
2514  if(!has_alpha)
2515  loss_mask &= ~FF_LOSS_ALPHA;
2516 
2517  score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
2518  score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
2519 
2520  if (score1 == score2) {
2522  dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
2523  } else {
2524  dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
2525  }
2526  } else {
2527  dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
2528  }
2529 
2530  if (loss_ptr)
2531  *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
2532  return dst_pix_fmt;
2533 }
2534 
2535 const char *av_color_range_name(enum AVColorRange range)
2536 {
2537  return (unsigned) range < AVCOL_RANGE_NB ?
2538  color_range_names[range] : NULL;
2539 }
2540 
2541 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
2542 {
2543  return (unsigned) primaries < AVCOL_PRI_NB ?
2544  color_primaries_names[primaries] : NULL;
2545 }
2546 
2548 {
2549  return (unsigned) transfer < AVCOL_TRC_NB ?
2550  color_transfer_names[transfer] : NULL;
2551 }
2552 
2553 const char *av_color_space_name(enum AVColorSpace space)
2554 {
2555  return (unsigned) space < AVCOL_SPC_NB ?
2556  color_space_names[space] : NULL;
2557 }
2558 
2559 const char *av_chroma_location_name(enum AVChromaLocation location)
2560 {
2561  return (unsigned) location < AVCHROMA_LOC_NB ?
2562  chroma_location_names[location] : NULL;
2563 }
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition: pixdesc.h:132
int plane
Definition: avisynth_c.h:291
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:304
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:634
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:288
const char * s
Definition: avisynth_c.h:631
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:265
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:258
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2222
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:262
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:170
8 bits gray, 8 bits alpha
Definition: pixfmt.h:154
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
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:322
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2262
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:89
hardware decoding through Videotoolbox
Definition: pixfmt.h:295
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:324
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:2174
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:2207
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:263
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
Definition: pixfmt.h:275
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
Definition: pixfmt.h:276
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:218
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:283
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:2100
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:200
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:268
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:252
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
Definition: pixfmt.h:273
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:2319
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:267
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
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:408
static const char * chroma_location_names[AVCHROMA_LOC_NB]
Definition: pixdesc.c:2120
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
const char * av_color_space_name(enum AVColorSpace space)
Definition: pixdesc.c:2553
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:190
#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:229
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:201
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:63
#define BAYER16_DESC_COMMON
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:251
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:434
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
Definition: pixfmt.h:281
const char * av_color_range_name(enum AVColorRange range)
Definition: pixdesc.c:2535
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
Definition: pixfmt.h:282
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:216
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:264
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
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition: pixfmt.h:113
static const char * color_transfer_names[AVCOL_TRC_NB]
Definition: pixdesc.c:2106
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:202
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:289
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:185
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:205
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:458
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:454
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:291
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:277
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:181
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:2559
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:187
16 bits gray, 16 bits alpha (big-endian)
Definition: pixfmt.h:225
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:2250
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:2187
Not part of ABI.
Definition: pixfmt.h:402
#define FF_LOSS_DEPTH
loss due to color depth change
Definition: pixdesc.h:320
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:193
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
#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:261
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:298
Libavutil version macros.
HW acceleration through VDA, data[3] contains a CVPixelBufferRef.
Definition: pixfmt.h:223
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:194
#define FFMAX(a, b)
Definition: common.h:94
static const char * color_space_names[AVCOL_SPC_NB]
Definition: pixdesc.c:2114
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:2541
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:195
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
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:300
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
Definition: pixdesc.c:2241
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:303
#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
#define FF_COLOR_YUV_JPEG
YUV color space.
Definition: pixdesc.c:2341
#define AV_PIX_FMT_FLAG_PSEUDOPAL
The pixel format is "pseudo-paletted".
Definition: pixdesc.h:158
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:199
#define FF_COLOR_XYZ
Definition: pixdesc.c:2342
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition: pixfmt.h:221
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:191
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:256
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:211
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:214
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
Definition: pixfmt.h:297
static int get_color_type(const AVPixFmtDescriptor *desc)
Definition: pixdesc.c:2348
#define src
Definition: vp9dsp.c:530
#define pixdesc_has_alpha(pixdesc)
Definition: pixdesc.c:2344
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:248
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition: pixfmt.h:118
#define FF_ARRAY_ELEMS(a)
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:301
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
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:188
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:280
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:183
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
Definition: pixfmt.h:284
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:203
static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, unsigned *lossp, unsigned consider)
Definition: pixdesc.c:2388
#define FF_COLOR_YUV
YUV color space.
Definition: pixdesc.c:2340
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:290
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:270
void * buf
Definition: avisynth_c.h:553
MPEG-4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstr...
Definition: pixfmt.h:146
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:204
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:206
Y , 16bpp, big-endian.
Definition: pixfmt.h:98
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
Definition: pixfmt.h:208
static enum AVPixelFormat get_pix_fmt_internal(const char *name)
Definition: pixdesc.c:2125
Not part of ABI.
Definition: pixfmt.h:428
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:257
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:2493
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
Definition: pixfmt.h:235
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:253
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:269
static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2370
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
Definition: pixfmt.h:189
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:278
#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
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:198
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:279
#define FF_COLOR_RGB
RGB color space.
Definition: pixdesc.c:2338
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
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:2147
#define FF_LOSS_COLORSPACE
loss due to color space conversion
Definition: pixdesc.h:321
#define AV_PIX_FMT_XVMC
Definition: pixfmt.h:80
hardware decoding through VDA
Definition: pixfmt.h:179
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:260
Y , 8bpp.
Definition: pixfmt.h:70
#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:228
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:182
static double c[64]
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition: pixdesc.c:2547
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
#define AV_WL16(p, v)
Definition: intreadwrite.h:412
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:274
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:212
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:2504
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:196
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
Definition: pixdesc.h:128
#define FF_LOSS_RESOLUTION
loss due to resolution change
Definition: pixdesc.h:319
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:210
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:293
#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:266
static uint8_t tmp[8]
Definition: des.c:38
static FF_ENABLE_DEPRECATION_WARNINGS const char * color_range_names[AVCOL_RANGE_NB]
Definition: pixdesc.c:2096
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:271
Not part of ABI.
Definition: pixfmt.h:484
16 bits gray, 16 bits alpha (little-endian)
Definition: pixfmt.h:226
#define FF_COLOR_NA
Definition: pixdesc.c:2337
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:197
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:306
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:323
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:476
HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer...
Definition: pixfmt.h:242
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:186
void ff_check_pixfmt_descriptors(void)
Definition: pixdesc.c:2277
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:2150
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:2138
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:192
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:213
HW acceleration though MMAL, data[3] contains a pointer to the MMAL_BUFFER_HEADER_T structure...
Definition: pixfmt.h:240
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:230
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:250
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:255
Not part of ABI.
Definition: pixfmt.h:446
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:259
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:184
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
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:292
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
Definition: pixdesc.c:2229
const char * name
Definition: opengl_enc.c:103
#define FF_COLOR_GRAY
gray color space
Definition: pixdesc.c:2339
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:171