Statistics
| Branch: | Revision:

ffmpeg / libavutil / pixdesc.c @ 80a07f6e

History | View | Annotate | Download (18.3 KB)

1 9b61d838 Michael Niedermayer
/*
2 e0cffbe7 Diego Biurrun
 * pixel format descriptor
3 9b61d838 Michael Niedermayer
 * 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 51135d1d Stefano Sabatini
#include "pixfmt.h"
23 9b61d838 Michael Niedermayer
#include "pixdesc.h"
24
25 d2863e72 Stefano Sabatini
const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
26 bcbd9a14 Stefano Sabatini
    [PIX_FMT_YUV420P] = {
27
        .name = "yuv420p",
28 b8873c2a Stefano Sabatini
        .nb_components= 3,
29 9b61d838 Michael Niedermayer
        .log2_chroma_w= 1,
30 bcbd9a14 Stefano Sabatini
        .log2_chroma_h= 1,
31 9b61d838 Michael Niedermayer
        .comp = {
32 eb39fb51 Stefano Sabatini
            {0,0,1,0,7},        /* Y */
33
            {1,0,1,0,7},        /* U */
34
            {2,0,1,0,7},        /* V */
35 9b61d838 Michael Niedermayer
        },
36
    },
37 bcbd9a14 Stefano Sabatini
    [PIX_FMT_YUYV422] = {
38
        .name = "yuyv422",
39 b8873c2a Stefano Sabatini
        .nb_components= 3,
40 9b61d838 Michael Niedermayer
        .log2_chroma_w= 1,
41 bcbd9a14 Stefano Sabatini
        .log2_chroma_h= 0,
42
        .comp = {
43
            {0,1,1,0,7},        /* Y */
44
            {0,3,2,0,7},        /* U */
45
            {0,3,4,0,7},        /* V */
46
        },
47
    },
48
    [PIX_FMT_RGB24] = {
49
        .name = "rgb24",
50 b8873c2a Stefano Sabatini
        .nb_components= 3,
51 bcbd9a14 Stefano Sabatini
        .log2_chroma_w= 0,
52
        .log2_chroma_h= 0,
53
        .comp = {
54
            {0,2,1,0,7},        /* R */
55
            {0,2,2,0,7},        /* G */
56
            {0,2,3,0,7},        /* B */
57
        },
58
    },
59 10151b13 Stefano Sabatini
    [PIX_FMT_BGR24] = {
60
        .name = "bgr24",
61 b8873c2a Stefano Sabatini
        .nb_components= 3,
62 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
63
        .log2_chroma_h= 0,
64
        .comp = {
65
            {0,2,1,0,7},        /* B */
66
            {0,2,2,0,7},        /* G */
67
            {0,2,3,0,7},        /* R */
68
        },
69
    },
70 bcbd9a14 Stefano Sabatini
    [PIX_FMT_YUV422P] = {
71
        .name = "yuv422p",
72 b8873c2a Stefano Sabatini
        .nb_components= 3,
73 bcbd9a14 Stefano Sabatini
        .log2_chroma_w= 1,
74
        .log2_chroma_h= 0,
75 9b61d838 Michael Niedermayer
        .comp = {
76 eb39fb51 Stefano Sabatini
            {0,0,1,0,7},        /* Y */
77
            {1,0,1,0,7},        /* U */
78
            {2,0,1,0,7},        /* V */
79 9b61d838 Michael Niedermayer
        },
80
    },
81 10151b13 Stefano Sabatini
    [PIX_FMT_YUV444P] = {
82
        .name = "yuv444p",
83 b8873c2a Stefano Sabatini
        .nb_components= 3,
84 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
85
        .log2_chroma_h= 0,
86
        .comp = {
87
            {0,0,1,0,7},        /* Y */
88
            {1,0,1,0,7},        /* U */
89
            {2,0,1,0,7},        /* V */
90
        },
91
    },
92 9b61d838 Michael Niedermayer
    [PIX_FMT_YUV410P] = {
93 1e896640 Stefano Sabatini
        .name = "yuv410p",
94 b8873c2a Stefano Sabatini
        .nb_components= 3,
95 9b61d838 Michael Niedermayer
        .log2_chroma_w= 2,
96
        .log2_chroma_h= 2,
97
        .comp = {
98 eb39fb51 Stefano Sabatini
            {0,0,1,0,7},        /* Y */
99
            {1,0,1,0,7},        /* U */
100
            {2,0,1,0,7},        /* V */
101 9b61d838 Michael Niedermayer
        },
102
    },
103 10151b13 Stefano Sabatini
    [PIX_FMT_YUV411P] = {
104
        .name = "yuv411p",
105 b8873c2a Stefano Sabatini
        .nb_components= 3,
106 10151b13 Stefano Sabatini
        .log2_chroma_w= 2,
107
        .log2_chroma_h= 0,
108
        .comp = {
109
            {0,0,1,0,7},        /* Y */
110
            {1,0,1,0,7},        /* U */
111
            {2,0,1,0,7},        /* V */
112
        },
113
    },
114
    [PIX_FMT_GRAY8] = {
115 382cb115 Stefano Sabatini
        .name = "gray",
116 b8873c2a Stefano Sabatini
        .nb_components= 1,
117 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
118
        .log2_chroma_h= 0,
119
        .comp = {
120
            {0,0,1,0,7},        /* Y */
121
        },
122
    },
123
    [PIX_FMT_MONOWHITE] = {
124 382cb115 Stefano Sabatini
        .name = "monow",
125 b8873c2a Stefano Sabatini
        .nb_components= 1,
126 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
127
        .log2_chroma_h= 0,
128
        .comp = {
129
            {0,0,1,0,0},        /* Y */
130
        },
131
        .flags = PIX_FMT_BITSTREAM,
132
    },
133 bcbd9a14 Stefano Sabatini
    [PIX_FMT_MONOBLACK] = {
134 382cb115 Stefano Sabatini
        .name = "monob",
135 b8873c2a Stefano Sabatini
        .nb_components= 1,
136 bcbd9a14 Stefano Sabatini
        .log2_chroma_w= 0,
137
        .log2_chroma_h= 0,
138 9b61d838 Michael Niedermayer
        .comp = {
139 bcbd9a14 Stefano Sabatini
            {0,0,1,7,0},        /* Y */
140 9b61d838 Michael Niedermayer
        },
141 bcbd9a14 Stefano Sabatini
        .flags = PIX_FMT_BITSTREAM,
142 9b61d838 Michael Niedermayer
    },
143 bcbd9a14 Stefano Sabatini
    [PIX_FMT_PAL8] = {
144
        .name = "pal8",
145 b8873c2a Stefano Sabatini
        .nb_components= 1,
146 bcbd9a14 Stefano Sabatini
        .log2_chroma_w= 0,
147 9b61d838 Michael Niedermayer
        .log2_chroma_h= 0,
148
        .comp = {
149 bcbd9a14 Stefano Sabatini
            {0,0,1,0,7},
150 9b61d838 Michael Niedermayer
        },
151 bcbd9a14 Stefano Sabatini
        .flags = PIX_FMT_PAL,
152 9b61d838 Michael Niedermayer
    },
153 10151b13 Stefano Sabatini
    [PIX_FMT_YUVJ420P] = {
154
        .name = "yuvj420p",
155 b8873c2a Stefano Sabatini
        .nb_components= 3,
156 10151b13 Stefano Sabatini
        .log2_chroma_w= 1,
157
        .log2_chroma_h= 1,
158
        .comp = {
159
            {0,0,1,0,7},        /* Y */
160
            {1,0,1,0,7},        /* U */
161
            {2,0,1,0,7},        /* V */
162
        },
163
    },
164
    [PIX_FMT_YUVJ422P] = {
165
        .name = "yuvj422p",
166 b8873c2a Stefano Sabatini
        .nb_components= 3,
167 10151b13 Stefano Sabatini
        .log2_chroma_w= 1,
168
        .log2_chroma_h= 0,
169
        .comp = {
170
            {0,0,1,0,7},        /* Y */
171
            {1,0,1,0,7},        /* U */
172
            {2,0,1,0,7},        /* V */
173
        },
174
    },
175
    [PIX_FMT_YUVJ444P] = {
176
        .name = "yuvj444p",
177 b8873c2a Stefano Sabatini
        .nb_components= 3,
178 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
179
        .log2_chroma_h= 0,
180
        .comp = {
181
            {0,0,1,0,7},        /* Y */
182
            {1,0,1,0,7},        /* U */
183
            {2,0,1,0,7},        /* V */
184
        },
185
    },
186 3fa70a3b Stefano Sabatini
    [PIX_FMT_XVMC_MPEG2_MC] = {
187 382cb115 Stefano Sabatini
        .name = "xvmcmc",
188 3fa70a3b Stefano Sabatini
        .flags = PIX_FMT_HWACCEL,
189
    },
190
    [PIX_FMT_XVMC_MPEG2_IDCT] = {
191 382cb115 Stefano Sabatini
        .name = "xvmcidct",
192 3fa70a3b Stefano Sabatini
        .flags = PIX_FMT_HWACCEL,
193
    },
194 9b61d838 Michael Niedermayer
    [PIX_FMT_UYVY422] = {
195 1e896640 Stefano Sabatini
        .name = "uyvy422",
196 b8873c2a Stefano Sabatini
        .nb_components= 3,
197 9b61d838 Michael Niedermayer
        .log2_chroma_w= 1,
198
        .log2_chroma_h= 0,
199
        .comp = {
200 eb39fb51 Stefano Sabatini
            {0,1,2,0,7},        /* Y */
201
            {0,3,1,0,7},        /* U */
202
            {0,3,3,0,7},        /* V */
203 9b61d838 Michael Niedermayer
        },
204
    },
205 10151b13 Stefano Sabatini
    [PIX_FMT_UYYVYY411] = {
206
        .name = "uyyvyy411",
207 b8873c2a Stefano Sabatini
        .nb_components= 3,
208 10151b13 Stefano Sabatini
        .log2_chroma_w= 2,
209
        .log2_chroma_h= 0,
210
        .comp = {
211
            {0,3,2,0,7},        /* Y */
212
            {0,5,1,0,7},        /* U */
213
            {0,5,4,0,7},        /* V */
214
        },
215
    },
216
    [PIX_FMT_BGR8] = {
217
        .name = "bgr8",
218 b8873c2a Stefano Sabatini
        .nb_components= 3,
219 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
220
        .log2_chroma_h= 0,
221
        .comp = {
222
            {0,0,1,6,1},        /* B */
223
            {0,0,1,3,2},        /* G */
224
            {0,0,1,0,2},        /* R */
225
        },
226 d71ad089 Stefano Sabatini
        .flags = PIX_FMT_PAL,
227 10151b13 Stefano Sabatini
    },
228
    [PIX_FMT_BGR4] = {
229
        .name = "bgr4",
230 b8873c2a Stefano Sabatini
        .nb_components= 3,
231 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
232
        .log2_chroma_h= 0,
233
        .comp = {
234
            {0,3,1,0,0},        /* B */
235
            {0,3,2,0,1},        /* G */
236
            {0,3,4,0,0},        /* R */
237
        },
238
        .flags = PIX_FMT_BITSTREAM,
239
    },
240
    [PIX_FMT_BGR4_BYTE] = {
241
        .name = "bgr4_byte",
242 b8873c2a Stefano Sabatini
        .nb_components= 3,
243 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
244
        .log2_chroma_h= 0,
245
        .comp = {
246
            {0,0,1,3,0},        /* B */
247
            {0,0,1,1,1},        /* G */
248
            {0,0,1,0,0},        /* R */
249
        },
250 d71ad089 Stefano Sabatini
        .flags = PIX_FMT_PAL,
251 10151b13 Stefano Sabatini
    },
252
    [PIX_FMT_RGB8] = {
253
        .name = "rgb8",
254 b8873c2a Stefano Sabatini
        .nb_components= 3,
255 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
256
        .log2_chroma_h= 0,
257
        .comp = {
258
            {0,0,1,6,1},        /* R */
259
            {0,0,1,3,2},        /* G */
260
            {0,0,1,0,2},        /* B */
261
        },
262 d71ad089 Stefano Sabatini
        .flags = PIX_FMT_PAL,
263 10151b13 Stefano Sabatini
    },
264
    [PIX_FMT_RGB4] = {
265
        .name = "rgb4",
266 b8873c2a Stefano Sabatini
        .nb_components= 3,
267 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
268
        .log2_chroma_h= 0,
269
        .comp = {
270
            {0,3,1,0,0},       /* R */
271
            {0,3,2,0,1},       /* G */
272
            {0,3,4,0,0},       /* B */
273
        },
274
        .flags = PIX_FMT_BITSTREAM,
275
    },
276
    [PIX_FMT_RGB4_BYTE] = {
277
        .name = "rgb4_byte",
278 b8873c2a Stefano Sabatini
        .nb_components= 3,
279 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
280
        .log2_chroma_h= 0,
281
        .comp = {
282
            {0,0,1,3,0},        /* R */
283
            {0,0,1,1,1},        /* G */
284
            {0,0,1,0,0},        /* B */
285
        },
286 d71ad089 Stefano Sabatini
        .flags = PIX_FMT_PAL,
287 10151b13 Stefano Sabatini
    },
288 bcbd9a14 Stefano Sabatini
    [PIX_FMT_NV12] = {
289
        .name = "nv12",
290 b8873c2a Stefano Sabatini
        .nb_components= 3,
291 bcbd9a14 Stefano Sabatini
        .log2_chroma_w= 1,
292
        .log2_chroma_h= 1,
293 9b61d838 Michael Niedermayer
        .comp = {
294 bcbd9a14 Stefano Sabatini
            {0,0,1,0,7},        /* Y */
295
            {1,1,1,0,7},        /* U */
296
            {1,1,2,0,7},        /* V */
297 9b61d838 Michael Niedermayer
        },
298
    },
299 10151b13 Stefano Sabatini
    [PIX_FMT_NV21] = {
300
        .name = "nv21",
301 b8873c2a Stefano Sabatini
        .nb_components= 3,
302 10151b13 Stefano Sabatini
        .log2_chroma_w= 1,
303
        .log2_chroma_h= 1,
304
        .comp = {
305
            {0,0,1,0,7},        /* Y */
306
            {1,1,1,0,7},        /* V */
307
            {1,1,2,0,7},        /* U */
308
        },
309
    },
310
    [PIX_FMT_ARGB] = {
311
        .name = "argb",
312 b8873c2a Stefano Sabatini
        .nb_components= 4,
313 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
314
        .log2_chroma_h= 0,
315
        .comp = {
316
            {0,3,1,0,7},        /* A */
317
            {0,3,2,0,7},        /* R */
318
            {0,3,3,0,7},        /* G */
319
            {0,3,4,0,7},        /* B */
320
        },
321
    },
322 9b61d838 Michael Niedermayer
    [PIX_FMT_RGBA] = {
323 1e896640 Stefano Sabatini
        .name = "rgba",
324 b8873c2a Stefano Sabatini
        .nb_components= 4,
325 9b61d838 Michael Niedermayer
        .log2_chroma_w= 0,
326
        .log2_chroma_h= 0,
327
        .comp = {
328 eb39fb51 Stefano Sabatini
            {0,3,1,0,7},        /* R */
329
            {0,3,2,0,7},        /* G */
330
            {0,3,3,0,7},        /* B */
331
            {0,3,4,0,7},        /* A */
332 9b61d838 Michael Niedermayer
        },
333
    },
334 10151b13 Stefano Sabatini
    [PIX_FMT_ABGR] = {
335
        .name = "abgr",
336 b8873c2a Stefano Sabatini
        .nb_components= 4,
337 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
338
        .log2_chroma_h= 0,
339
        .comp = {
340
            {0,3,1,0,7},        /* A */
341
            {0,3,2,0,7},        /* B */
342
            {0,3,3,0,7},        /* G */
343
            {0,3,4,0,7},        /* R */
344
        },
345
    },
346
    [PIX_FMT_BGRA] = {
347
        .name = "bgra",
348 b8873c2a Stefano Sabatini
        .nb_components= 4,
349 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
350
        .log2_chroma_h= 0,
351
        .comp = {
352
            {0,3,1,0,7},        /* B */
353
            {0,3,2,0,7},        /* G */
354
            {0,3,3,0,7},        /* R */
355
            {0,3,4,0,7},        /* A */
356
        },
357
    },
358 bcbd9a14 Stefano Sabatini
    [PIX_FMT_GRAY16BE] = {
359
        .name = "gray16be",
360 b8873c2a Stefano Sabatini
        .nb_components= 1,
361 9b61d838 Michael Niedermayer
        .log2_chroma_w= 0,
362
        .log2_chroma_h= 0,
363
        .comp = {
364 bcbd9a14 Stefano Sabatini
            {0,1,1,0,15},       /* Y */
365
        },
366
        .flags = PIX_FMT_BE,
367
    },
368
    [PIX_FMT_GRAY16LE] = {
369
        .name = "gray16le",
370 b8873c2a Stefano Sabatini
        .nb_components= 1,
371 bcbd9a14 Stefano Sabatini
        .log2_chroma_w= 0,
372
        .log2_chroma_h= 0,
373
        .comp = {
374
            {0,1,1,0,15},       /* Y */
375 9b61d838 Michael Niedermayer
        },
376
    },
377 10151b13 Stefano Sabatini
    [PIX_FMT_YUV440P] = {
378
        .name = "yuv440p",
379 b8873c2a Stefano Sabatini
        .nb_components= 3,
380 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
381
        .log2_chroma_h= 1,
382
        .comp = {
383
            {0,0,1,0,7},        /* Y */
384
            {1,0,1,0,7},        /* U */
385
            {2,0,1,0,7},        /* V */
386
        },
387
    },
388
    [PIX_FMT_YUVJ440P] = {
389
        .name = "yuvj440p",
390 b8873c2a Stefano Sabatini
        .nb_components= 3,
391 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
392
        .log2_chroma_h= 1,
393
        .comp = {
394
            {0,0,1,0,7},        /* Y */
395
            {1,0,1,0,7},        /* U */
396
            {2,0,1,0,7},        /* V */
397
        },
398
    },
399
    [PIX_FMT_YUVA420P] = {
400
        .name = "yuva420p",
401 b8873c2a Stefano Sabatini
        .nb_components= 4,
402 10151b13 Stefano Sabatini
        .log2_chroma_w= 1,
403
        .log2_chroma_h= 1,
404
        .comp = {
405
            {0,0,1,0,7},        /* Y */
406
            {1,0,1,0,7},        /* U */
407
            {2,0,1,0,7},        /* V */
408
            {3,0,1,0,7},        /* A */
409
        },
410
    },
411 3fa70a3b Stefano Sabatini
    [PIX_FMT_VDPAU_H264] = {
412
        .name = "vdpau_h264",
413
        .log2_chroma_w = 1,
414
        .log2_chroma_h = 1,
415
        .flags = PIX_FMT_HWACCEL,
416
    },
417
    [PIX_FMT_VDPAU_MPEG1] = {
418
        .name = "vdpau_mpeg1",
419
        .log2_chroma_w = 1,
420
        .log2_chroma_h = 1,
421
        .flags = PIX_FMT_HWACCEL,
422
    },
423
    [PIX_FMT_VDPAU_MPEG2] = {
424
        .name = "vdpau_mpeg2",
425
        .log2_chroma_w = 1,
426
        .log2_chroma_h = 1,
427
        .flags = PIX_FMT_HWACCEL,
428
    },
429
    [PIX_FMT_VDPAU_WMV3] = {
430
        .name = "vdpau_wmv3",
431
        .log2_chroma_w = 1,
432
        .log2_chroma_h = 1,
433
        .flags = PIX_FMT_HWACCEL,
434
    },
435
    [PIX_FMT_VDPAU_VC1] = {
436
        .name = "vdpau_vc1",
437
        .log2_chroma_w = 1,
438
        .log2_chroma_h = 1,
439
        .flags = PIX_FMT_HWACCEL,
440
    },
441 dd6308ad Carl Eugen Hoyos
    [PIX_FMT_VDPAU_MPEG4] = {
442
        .name = "vdpau_mpeg4",
443
        .log2_chroma_w = 1,
444
        .log2_chroma_h = 1,
445
        .flags = PIX_FMT_HWACCEL,
446
    },
447 9b61d838 Michael Niedermayer
    [PIX_FMT_RGB48BE] = {
448 1e896640 Stefano Sabatini
        .name = "rgb48be",
449 b8873c2a Stefano Sabatini
        .nb_components= 3,
450 9b61d838 Michael Niedermayer
        .log2_chroma_w= 0,
451
        .log2_chroma_h= 0,
452
        .comp = {
453 eb39fb51 Stefano Sabatini
            {0,5,1,0,15},       /* R */
454
            {0,5,3,0,15},       /* G */
455
            {0,5,5,0,15},       /* B */
456 9b61d838 Michael Niedermayer
        },
457
        .flags = PIX_FMT_BE,
458
    },
459 bcbd9a14 Stefano Sabatini
    [PIX_FMT_RGB48LE] = {
460
        .name = "rgb48le",
461 b8873c2a Stefano Sabatini
        .nb_components= 3,
462 9b61d838 Michael Niedermayer
        .log2_chroma_w= 0,
463
        .log2_chroma_h= 0,
464
        .comp = {
465 bcbd9a14 Stefano Sabatini
            {0,5,1,0,15},       /* R */
466
            {0,5,3,0,15},       /* G */
467
            {0,5,5,0,15},       /* B */
468 9b61d838 Michael Niedermayer
        },
469
    },
470 e5681ba0 Stefano Sabatini
    [PIX_FMT_RGB565BE] = {
471 1e896640 Stefano Sabatini
        .name = "rgb565be",
472 b8873c2a Stefano Sabatini
        .nb_components= 3,
473 9b61d838 Michael Niedermayer
        .log2_chroma_w= 0,
474
        .log2_chroma_h= 0,
475
        .comp = {
476 eb39fb51 Stefano Sabatini
            {0,1,0,3,4},        /* R */
477 f938cbf9 Stefano Sabatini
            {0,1,1,5,5},        /* G */
478
            {0,1,1,0,4},        /* B */
479 9b61d838 Michael Niedermayer
        },
480
        .flags = PIX_FMT_BE,
481
    },
482 bcbd9a14 Stefano Sabatini
    [PIX_FMT_RGB565LE] = {
483
        .name = "rgb565le",
484 b8873c2a Stefano Sabatini
        .nb_components= 3,
485 9b61d838 Michael Niedermayer
        .log2_chroma_w= 0,
486
        .log2_chroma_h= 0,
487
        .comp = {
488 bcbd9a14 Stefano Sabatini
            {0,1,2,3,4},        /* R */
489
            {0,1,1,5,5},        /* G */
490
            {0,1,1,0,4},        /* B */
491 9b61d838 Michael Niedermayer
        },
492
    },
493 10151b13 Stefano Sabatini
    [PIX_FMT_RGB555BE] = {
494
        .name = "rgb555be",
495 b8873c2a Stefano Sabatini
        .nb_components= 3,
496 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
497
        .log2_chroma_h= 0,
498
        .comp = {
499
            {0,1,0,2,4},        /* R */
500
            {0,1,1,5,4},        /* G */
501
            {0,1,1,0,4},        /* B */
502
        },
503
        .flags = PIX_FMT_BE,
504
    },
505
    [PIX_FMT_RGB555LE] = {
506
        .name = "rgb555le",
507 b8873c2a Stefano Sabatini
        .nb_components= 3,
508 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
509
        .log2_chroma_h= 0,
510
        .comp = {
511
            {0,1,2,2,4},        /* R */
512
            {0,1,1,5,4},        /* G */
513
            {0,1,1,0,4},        /* B */
514
        },
515
    },
516
    [PIX_FMT_BGR565BE] = {
517
        .name = "bgr565be",
518 b8873c2a Stefano Sabatini
        .nb_components= 3,
519 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
520
        .log2_chroma_h= 0,
521
        .comp = {
522
            {0,1,0,3,4},        /* B */
523
            {0,1,1,5,5},        /* G */
524
            {0,1,1,0,4},        /* R */
525
        },
526
        .flags = PIX_FMT_BE,
527
    },
528
    [PIX_FMT_BGR565LE] = {
529
        .name = "bgr565le",
530 b8873c2a Stefano Sabatini
        .nb_components= 3,
531 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
532
        .log2_chroma_h= 0,
533
        .comp = {
534
            {0,1,2,3,4},        /* B */
535
            {0,1,1,5,5},        /* G */
536
            {0,1,1,0,4},        /* R */
537
        },
538
    },
539
    [PIX_FMT_BGR555BE] = {
540
        .name = "bgr555be",
541 b8873c2a Stefano Sabatini
        .nb_components= 3,
542 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
543
        .log2_chroma_h= 0,
544
        .comp = {
545
            {0,1,0,2,4},       /* B */
546
            {0,1,1,5,4},       /* G */
547
            {0,1,1,0,4},       /* R */
548
        },
549
        .flags = PIX_FMT_BE,
550
     },
551
    [PIX_FMT_BGR555LE] = {
552
        .name = "bgr555le",
553 b8873c2a Stefano Sabatini
        .nb_components= 3,
554 10151b13 Stefano Sabatini
        .log2_chroma_w= 0,
555
        .log2_chroma_h= 0,
556
        .comp = {
557
            {0,1,2,2,4},        /* B */
558
            {0,1,1,5,4},        /* G */
559
            {0,1,1,0,4},        /* R */
560
        },
561
    },
562 3fa70a3b Stefano Sabatini
    [PIX_FMT_VAAPI_MOCO] = {
563
        .name = "vaapi_moco",
564
        .log2_chroma_w = 1,
565
        .log2_chroma_h = 1,
566
        .flags = PIX_FMT_HWACCEL,
567
    },
568
    [PIX_FMT_VAAPI_IDCT] = {
569
        .name = "vaapi_idct",
570
        .log2_chroma_w = 1,
571
        .log2_chroma_h = 1,
572
        .flags = PIX_FMT_HWACCEL,
573
    },
574
    [PIX_FMT_VAAPI_VLD] = {
575
        .name = "vaapi_vld",
576
        .log2_chroma_w = 1,
577
        .log2_chroma_h = 1,
578
        .flags = PIX_FMT_HWACCEL,
579
    },
580 35f6c154 Lars Täuber
    [PIX_FMT_YUV420P16LE] = {
581
        .name = "yuv420p16le",
582 b8873c2a Stefano Sabatini
        .nb_components= 3,
583 75801da5 Stefano Sabatini
        .log2_chroma_w= 1,
584
        .log2_chroma_h= 1,
585
        .comp = {
586
            {0,1,1,0,15},        /* Y */
587
            {1,1,1,0,15},        /* U */
588
            {2,1,1,0,15},        /* V */
589
        },
590
    },
591 35f6c154 Lars Täuber
    [PIX_FMT_YUV420P16BE] = {
592
        .name = "yuv420p16be",
593 b8873c2a Stefano Sabatini
        .nb_components= 3,
594 75801da5 Stefano Sabatini
        .log2_chroma_w= 1,
595
        .log2_chroma_h= 1,
596
        .comp = {
597
            {0,1,1,0,15},        /* Y */
598
            {1,1,1,0,15},        /* U */
599
            {2,1,1,0,15},        /* V */
600
        },
601
        .flags = PIX_FMT_BE,
602
    },
603 35f6c154 Lars Täuber
    [PIX_FMT_YUV422P16LE] = {
604
        .name = "yuv422p16le",
605 b8873c2a Stefano Sabatini
        .nb_components= 3,
606 75801da5 Stefano Sabatini
        .log2_chroma_w= 1,
607
        .log2_chroma_h= 0,
608
        .comp = {
609
            {0,1,1,0,15},        /* Y */
610
            {1,1,1,0,15},        /* U */
611
            {2,1,1,0,15},        /* V */
612
        },
613
    },
614 35f6c154 Lars Täuber
    [PIX_FMT_YUV422P16BE] = {
615
        .name = "yuv422p16be",
616 b8873c2a Stefano Sabatini
        .nb_components= 3,
617 75801da5 Stefano Sabatini
        .log2_chroma_w= 1,
618
        .log2_chroma_h= 0,
619
        .comp = {
620
            {0,1,1,0,15},        /* Y */
621
            {1,1,1,0,15},        /* U */
622
            {2,1,1,0,15},        /* V */
623
        },
624
        .flags = PIX_FMT_BE,
625
    },
626 35f6c154 Lars Täuber
    [PIX_FMT_YUV444P16LE] = {
627
        .name = "yuv444p16le",
628 b8873c2a Stefano Sabatini
        .nb_components= 3,
629 75801da5 Stefano Sabatini
        .log2_chroma_w= 0,
630
        .log2_chroma_h= 0,
631
        .comp = {
632
            {0,1,1,0,15},        /* Y */
633
            {1,1,1,0,15},        /* U */
634
            {2,1,1,0,15},        /* V */
635
        },
636
    },
637 35f6c154 Lars Täuber
    [PIX_FMT_YUV444P16BE] = {
638
        .name = "yuv444p16be",
639 b8873c2a Stefano Sabatini
        .nb_components= 3,
640 75801da5 Stefano Sabatini
        .log2_chroma_w= 0,
641
        .log2_chroma_h= 0,
642
        .comp = {
643
            {0,1,1,0,15},        /* Y */
644
            {1,1,1,0,15},        /* U */
645
            {2,1,1,0,15},        /* V */
646
        },
647
        .flags = PIX_FMT_BE,
648
    },
649 92c6a099 Laurent Aimar
    [PIX_FMT_DXVA2_VLD] = {
650
        .name = "dxva2_vld",
651
        .log2_chroma_w = 1,
652
        .log2_chroma_h = 1,
653
        .flags = PIX_FMT_HWACCEL,
654
    },
655 9b61d838 Michael Niedermayer
};
656 5efccce2 Stefano Sabatini
657 80a07f6e Stefano Sabatini
static enum PixelFormat get_pix_fmt_internal(const char *name)
658
{
659
    enum PixelFormat pix_fmt;
660
661
    for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
662
        if (av_pix_fmt_descriptors[pix_fmt].name &&
663
            !strcmp(av_pix_fmt_descriptors[pix_fmt].name, name))
664
            return pix_fmt;
665
666
    return PIX_FMT_NONE;
667
}
668
669
#if HAVE_BIGENDIAN
670
#   define X_NE(be, le) be
671
#else
672
#   define X_NE(be, le) le
673
#endif
674
675
enum PixelFormat av_get_pix_fmt(const char *name)
676
{
677
    enum PixelFormat pix_fmt;
678
679
    if (!strcmp(name, "rgb32"))
680
        name = X_NE("argb", "bgra");
681
    else if (!strcmp(name, "bgr32"))
682
        name = X_NE("abgr", "rgba");
683
684
    pix_fmt = get_pix_fmt_internal(name);
685
    if (pix_fmt == PIX_FMT_NONE) {
686
        char name2[32];
687
688
        snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
689
        pix_fmt = get_pix_fmt_internal(name2);
690
    }
691
    return pix_fmt;
692
}
693
694 5efccce2 Stefano Sabatini
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
695
{
696
    int c, bits = 0;
697
    int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
698
699 b8873c2a Stefano Sabatini
    for (c = 0; c < pixdesc->nb_components; c++) {
700 5efccce2 Stefano Sabatini
        int s = c==1 || c==2 ? 0 : log2_pixels;
701
        bits += (pixdesc->comp[c].depth_minus1+1) << s;
702
    }
703
704
    return bits >> log2_pixels;
705
}