h264dec: Add .avc file name extension
[libav.git] / libavutil / pixdesc.c
CommitLineData
9b61d838 1/*
e0cffbe7 2 * pixel format descriptor
9b61d838
MN
3 * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
4 *
2912e87a 5 * This file is part of Libav.
9b61d838 6 *
2912e87a 7 * Libav is free software; you can redistribute it and/or
9b61d838
MN
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 *
2912e87a 12 * Libav is distributed in the hope that it will be useful,
9b61d838
MN
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
2912e87a 18 * License along with Libav; if not, write to the Free Software
9b61d838
MN
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
47bfd50a
MR
22#include <stdio.h>
23#include <string.h>
d2fcb356
AK
24
25#include "common.h"
51135d1d 26#include "pixfmt.h"
9b61d838 27#include "pixdesc.h"
7950e519 28#include "internal.h"
f47a7cb7
SS
29#include "intreadwrite.h"
30
a6842670
LB
31void av_read_image_line(uint16_t *dst,
32 const uint8_t *data[4], const int linesize[4],
33 const AVPixFmtDescriptor *desc,
34 int x, int y, int c, int w,
4a59eca9 35 int read_pal_component)
f47a7cb7 36{
4a59eca9
TB
37 AVComponentDescriptor comp = desc->comp[c];
38 int plane = comp.plane;
39 int depth = comp.depth_minus1 + 1;
40 int mask = (1 << depth) - 1;
41 int shift = comp.shift;
42 int step = comp.step_minus1 + 1;
43 int flags = desc->flags;
f47a7cb7 44
e6c4ac7b 45 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
4a59eca9
TB
46 int skip = x * step + comp.offset_plus1 - 1;
47 const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
48 int shift = 8 - depth - (skip & 7);
f47a7cb7 49
4a59eca9 50 while (w--) {
f47a7cb7 51 int val = (*p >> shift) & mask;
4a59eca9
TB
52 if (read_pal_component)
53 val = data[1][4*val + c];
f47a7cb7 54 shift -= step;
4a59eca9 55 p -= shift >> 3;
f47a7cb7 56 shift &= 7;
4a59eca9 57 *dst++ = val;
f47a7cb7
SS
58 }
59 } else {
a6842670
LB
60 const uint8_t *p = data[plane] + y * linesize[plane] +
61 x * step + comp.offset_plus1 - 1;
4660143a 62 int is_8bit = shift + depth <= 8;
f47a7cb7 63
4660143a 64 if (is_8bit)
e6c4ac7b 65 p += !!(flags & AV_PIX_FMT_FLAG_BE);
4660143a 66
4a59eca9 67 while (w--) {
9525243f 68 int val = is_8bit ? *p :
e6c4ac7b 69 flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
4a59eca9
TB
70 val = (val >> shift) & mask;
71 if (read_pal_component)
72 val = data[1][4 * val + c];
73 p += step;
74 *dst++ = val;
f47a7cb7
SS
75 }
76 }
77}
78
a6842670
LB
79void av_write_image_line(const uint16_t *src,
80 uint8_t *data[4], const int linesize[4],
81 const AVPixFmtDescriptor *desc,
82 int x, int y, int c, int w)
f47a7cb7
SS
83{
84 AVComponentDescriptor comp = desc->comp[c];
85 int plane = comp.plane;
4a59eca9
TB
86 int depth = comp.depth_minus1 + 1;
87 int step = comp.step_minus1 + 1;
f47a7cb7
SS
88 int flags = desc->flags;
89
e6c4ac7b 90 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
4a59eca9
TB
91 int skip = x * step + comp.offset_plus1 - 1;
92 uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
93 int shift = 8 - depth - (skip & 7);
f47a7cb7
SS
94
95 while (w--) {
96 *p |= *src++ << shift;
97 shift -= step;
4a59eca9 98 p -= shift >> 3;
f47a7cb7
SS
99 shift &= 7;
100 }
101 } else {
102 int shift = comp.shift;
a6842670
LB
103 uint8_t *p = data[plane] + y * linesize[plane] +
104 x * step + comp.offset_plus1 - 1;
f47a7cb7 105
9525243f 106 if (shift + depth <= 8) {
e6c4ac7b 107 p += !!(flags & AV_PIX_FMT_FLAG_BE);
9525243f 108 while (w--) {
4a59eca9 109 *p |= (*src++ << shift);
9525243f
MR
110 p += step;
111 }
112 } else {
78b19cf0 113 while (w--) {
e6c4ac7b 114 if (flags & AV_PIX_FMT_FLAG_BE) {
4a59eca9 115 uint16_t val = AV_RB16(p) | (*src++ << shift);
78b19cf0
MR
116 AV_WB16(p, val);
117 } else {
4a59eca9 118 uint16_t val = AV_RL16(p) | (*src++ << shift);
78b19cf0
MR
119 AV_WL16(p, val);
120 }
4a59eca9 121 p += step;
f47a7cb7 122 }
9525243f 123 }
f47a7cb7
SS
124 }
125}
126
d2fcb356
AK
127#if !FF_API_PIX_FMT_DESC
128static
129#endif
716d413c
AK
130const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
131 [AV_PIX_FMT_YUV420P] = {
bcbd9a14 132 .name = "yuv420p",
4a59eca9
TB
133 .nb_components = 3,
134 .log2_chroma_w = 1,
135 .log2_chroma_h = 1,
9b61d838 136 .comp = {
4a59eca9
TB
137 { 0, 0, 1, 0, 7 }, /* Y */
138 { 1, 0, 1, 0, 7 }, /* U */
139 { 2, 0, 1, 0, 7 }, /* V */
9b61d838 140 },
e6c4ac7b 141 .flags = AV_PIX_FMT_FLAG_PLANAR,
9b61d838 142 },
716d413c 143 [AV_PIX_FMT_YUYV422] = {
bcbd9a14 144 .name = "yuyv422",
4a59eca9
TB
145 .nb_components = 3,
146 .log2_chroma_w = 1,
147 .log2_chroma_h = 0,
bcbd9a14 148 .comp = {
4a59eca9
TB
149 { 0, 1, 1, 0, 7 }, /* Y */
150 { 0, 3, 2, 0, 7 }, /* U */
151 { 0, 3, 4, 0, 7 }, /* V */
bcbd9a14
SS
152 },
153 },
716d413c 154 [AV_PIX_FMT_RGB24] = {
bcbd9a14 155 .name = "rgb24",
4a59eca9
TB
156 .nb_components = 3,
157 .log2_chroma_w = 0,
158 .log2_chroma_h = 0,
bcbd9a14 159 .comp = {
4a59eca9
TB
160 { 0, 2, 1, 0, 7 }, /* R */
161 { 0, 2, 2, 0, 7 }, /* G */
162 { 0, 2, 3, 0, 7 }, /* B */
bcbd9a14 163 },
e6c4ac7b 164 .flags = AV_PIX_FMT_FLAG_RGB,
bcbd9a14 165 },
716d413c 166 [AV_PIX_FMT_BGR24] = {
10151b13 167 .name = "bgr24",
4a59eca9
TB
168 .nb_components = 3,
169 .log2_chroma_w = 0,
170 .log2_chroma_h = 0,
10151b13 171 .comp = {
4a59eca9
TB
172 { 0, 2, 1, 0, 7 }, /* B */
173 { 0, 2, 2, 0, 7 }, /* G */
174 { 0, 2, 3, 0, 7 }, /* R */
10151b13 175 },
e6c4ac7b 176 .flags = AV_PIX_FMT_FLAG_RGB,
10151b13 177 },
716d413c 178 [AV_PIX_FMT_YUV422P] = {
bcbd9a14 179 .name = "yuv422p",
4a59eca9
TB
180 .nb_components = 3,
181 .log2_chroma_w = 1,
182 .log2_chroma_h = 0,
9b61d838 183 .comp = {
4a59eca9
TB
184 { 0, 0, 1, 0, 7 }, /* Y */
185 { 1, 0, 1, 0, 7 }, /* U */
186 { 2, 0, 1, 0, 7 }, /* V */
9b61d838 187 },
e6c4ac7b 188 .flags = AV_PIX_FMT_FLAG_PLANAR,
9b61d838 189 },
716d413c 190 [AV_PIX_FMT_YUV444P] = {
10151b13 191 .name = "yuv444p",
4a59eca9
TB
192 .nb_components = 3,
193 .log2_chroma_w = 0,
194 .log2_chroma_h = 0,
10151b13 195 .comp = {
4a59eca9
TB
196 { 0, 0, 1, 0, 7 }, /* Y */
197 { 1, 0, 1, 0, 7 }, /* U */
198 { 2, 0, 1, 0, 7 }, /* V */
10151b13 199 },
e6c4ac7b 200 .flags = AV_PIX_FMT_FLAG_PLANAR,
10151b13 201 },
716d413c 202 [AV_PIX_FMT_YUV410P] = {
1e896640 203 .name = "yuv410p",
4a59eca9
TB
204 .nb_components = 3,
205 .log2_chroma_w = 2,
206 .log2_chroma_h = 2,
9b61d838 207 .comp = {
4a59eca9
TB
208 { 0, 0, 1, 0, 7 }, /* Y */
209 { 1, 0, 1, 0, 7 }, /* U */
210 { 2, 0, 1, 0, 7 }, /* V */
9b61d838 211 },
e6c4ac7b 212 .flags = AV_PIX_FMT_FLAG_PLANAR,
9b61d838 213 },
716d413c 214 [AV_PIX_FMT_YUV411P] = {
10151b13 215 .name = "yuv411p",
4a59eca9
TB
216 .nb_components = 3,
217 .log2_chroma_w = 2,
218 .log2_chroma_h = 0,
10151b13 219 .comp = {
4a59eca9
TB
220 { 0, 0, 1, 0, 7 }, /* Y */
221 { 1, 0, 1, 0, 7 }, /* U */
222 { 2, 0, 1, 0, 7 }, /* V */
10151b13 223 },
e6c4ac7b 224 .flags = AV_PIX_FMT_FLAG_PLANAR,
10151b13 225 },
716d413c 226 [AV_PIX_FMT_GRAY8] = {
382cb115 227 .name = "gray",
4a59eca9
TB
228 .nb_components = 1,
229 .log2_chroma_w = 0,
230 .log2_chroma_h = 0,
10151b13 231 .comp = {
4a59eca9 232 { 0, 0, 1, 0, 7 }, /* Y */
10151b13 233 },
78b4bfdb 234 .flags = AV_PIX_FMT_FLAG_PSEUDOPAL,
10151b13 235 },
716d413c 236 [AV_PIX_FMT_MONOWHITE] = {
382cb115 237 .name = "monow",
4a59eca9
TB
238 .nb_components = 1,
239 .log2_chroma_w = 0,
240 .log2_chroma_h = 0,
10151b13 241 .comp = {
4a59eca9 242 { 0, 0, 1, 0, 0 }, /* Y */
10151b13 243 },
e6c4ac7b 244 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
10151b13 245 },
716d413c 246 [AV_PIX_FMT_MONOBLACK] = {
382cb115 247 .name = "monob",
4a59eca9
TB
248 .nb_components = 1,
249 .log2_chroma_w = 0,
250 .log2_chroma_h = 0,
9b61d838 251 .comp = {
4a59eca9 252 { 0, 0, 1, 7, 0 }, /* Y */
9b61d838 253 },
e6c4ac7b 254 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
9b61d838 255 },
716d413c 256 [AV_PIX_FMT_PAL8] = {
bcbd9a14 257 .name = "pal8",
4a59eca9
TB
258 .nb_components = 1,
259 .log2_chroma_w = 0,
260 .log2_chroma_h = 0,
9b61d838 261 .comp = {
4a59eca9 262 { 0, 0, 1, 0, 7 },
9b61d838 263 },
e6c4ac7b 264 .flags = AV_PIX_FMT_FLAG_PAL,
9b61d838 265 },
716d413c 266 [AV_PIX_FMT_YUVJ420P] = {
10151b13 267 .name = "yuvj420p",
4a59eca9
TB
268 .nb_components = 3,
269 .log2_chroma_w = 1,
270 .log2_chroma_h = 1,
10151b13 271 .comp = {
4a59eca9
TB
272 { 0, 0, 1, 0, 7 }, /* Y */
273 { 1, 0, 1, 0, 7 }, /* U */
274 { 2, 0, 1, 0, 7 }, /* V */
10151b13 275 },
e6c4ac7b 276 .flags = AV_PIX_FMT_FLAG_PLANAR,
10151b13 277 },
716d413c 278 [AV_PIX_FMT_YUVJ422P] = {
10151b13 279 .name = "yuvj422p",
4a59eca9
TB
280 .nb_components = 3,
281 .log2_chroma_w = 1,
282 .log2_chroma_h = 0,
10151b13 283 .comp = {
4a59eca9
TB
284 { 0, 0, 1, 0, 7 }, /* Y */
285 { 1, 0, 1, 0, 7 }, /* U */
286 { 2, 0, 1, 0, 7 }, /* V */
10151b13 287 },
e6c4ac7b 288 .flags = AV_PIX_FMT_FLAG_PLANAR,
10151b13 289 },
716d413c 290 [AV_PIX_FMT_YUVJ444P] = {
10151b13 291 .name = "yuvj444p",
4a59eca9
TB
292 .nb_components = 3,
293 .log2_chroma_w = 0,
294 .log2_chroma_h = 0,
10151b13 295 .comp = {
4a59eca9
TB
296 {0, 0, 1, 0, 7}, /* Y */
297 {1, 0, 1, 0, 7}, /* U */
298 {2, 0, 1, 0, 7}, /* V */
10151b13 299 },
e6c4ac7b 300 .flags = AV_PIX_FMT_FLAG_PLANAR,
10151b13 301 },
716d413c 302 [AV_PIX_FMT_XVMC_MPEG2_MC] = {
382cb115 303 .name = "xvmcmc",
e6c4ac7b 304 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 305 },
716d413c 306 [AV_PIX_FMT_XVMC_MPEG2_IDCT] = {
382cb115 307 .name = "xvmcidct",
e6c4ac7b 308 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 309 },
716d413c 310 [AV_PIX_FMT_UYVY422] = {
1e896640 311 .name = "uyvy422",
4a59eca9
TB
312 .nb_components = 3,
313 .log2_chroma_w = 1,
314 .log2_chroma_h = 0,
9b61d838 315 .comp = {
4a59eca9
TB
316 { 0, 1, 2, 0, 7 }, /* Y */
317 { 0, 3, 1, 0, 7 }, /* U */
318 { 0, 3, 3, 0, 7 }, /* V */
9b61d838
MN
319 },
320 },
716d413c 321 [AV_PIX_FMT_UYYVYY411] = {
10151b13 322 .name = "uyyvyy411",
4a59eca9
TB
323 .nb_components = 3,
324 .log2_chroma_w = 2,
325 .log2_chroma_h = 0,
10151b13 326 .comp = {
4a59eca9
TB
327 { 0, 3, 2, 0, 7 }, /* Y */
328 { 0, 5, 1, 0, 7 }, /* U */
329 { 0, 5, 4, 0, 7 }, /* V */
10151b13
SS
330 },
331 },
716d413c 332 [AV_PIX_FMT_BGR8] = {
10151b13 333 .name = "bgr8",
4a59eca9
TB
334 .nb_components = 3,
335 .log2_chroma_w = 0,
336 .log2_chroma_h = 0,
10151b13 337 .comp = {
4a59eca9
TB
338 { 0, 0, 1, 6, 1 }, /* B */
339 { 0, 0, 1, 3, 2 }, /* G */
340 { 0, 0, 1, 0, 2 }, /* R */
10151b13 341 },
e6c4ac7b 342 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
10151b13 343 },
716d413c 344 [AV_PIX_FMT_BGR4] = {
10151b13 345 .name = "bgr4",
4a59eca9
TB
346 .nb_components = 3,
347 .log2_chroma_w = 0,
348 .log2_chroma_h = 0,
10151b13 349 .comp = {
4a59eca9
TB
350 { 0, 3, 1, 0, 0 }, /* B */
351 { 0, 3, 2, 0, 1 }, /* G */
352 { 0, 3, 4, 0, 0 }, /* R */
10151b13 353 },
e6c4ac7b 354 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
10151b13 355 },
716d413c 356 [AV_PIX_FMT_BGR4_BYTE] = {
10151b13 357 .name = "bgr4_byte",
4a59eca9
TB
358 .nb_components = 3,
359 .log2_chroma_w = 0,
360 .log2_chroma_h = 0,
10151b13 361 .comp = {
4a59eca9
TB
362 { 0, 0, 1, 3, 0 }, /* B */
363 { 0, 0, 1, 1, 1 }, /* G */
364 { 0, 0, 1, 0, 0 }, /* R */
10151b13 365 },
e6c4ac7b 366 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
10151b13 367 },
716d413c 368 [AV_PIX_FMT_RGB8] = {
10151b13 369 .name = "rgb8",
4a59eca9
TB
370 .nb_components = 3,
371 .log2_chroma_w = 0,
372 .log2_chroma_h = 0,
10151b13 373 .comp = {
4a59eca9
TB
374 { 0, 0, 1, 6, 1 }, /* R */
375 { 0, 0, 1, 3, 2 }, /* G */
376 { 0, 0, 1, 0, 2 }, /* B */
10151b13 377 },
e6c4ac7b 378 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
10151b13 379 },
716d413c 380 [AV_PIX_FMT_RGB4] = {
10151b13 381 .name = "rgb4",
4a59eca9
TB
382 .nb_components = 3,
383 .log2_chroma_w = 0,
384 .log2_chroma_h = 0,
10151b13 385 .comp = {
4a59eca9
TB
386 { 0, 3, 1, 0, 0 }, /* R */
387 { 0, 3, 2, 0, 1 }, /* G */
388 { 0, 3, 4, 0, 0 }, /* B */
10151b13 389 },
e6c4ac7b 390 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
10151b13 391 },
716d413c 392 [AV_PIX_FMT_RGB4_BYTE] = {
10151b13 393 .name = "rgb4_byte",
4a59eca9
TB
394 .nb_components = 3,
395 .log2_chroma_w = 0,
396 .log2_chroma_h = 0,
10151b13 397 .comp = {
4a59eca9
TB
398 { 0, 0, 1, 3, 0 }, /* R */
399 { 0, 0, 1, 1, 1 }, /* G */
400 { 0, 0, 1, 0, 0 }, /* B */
10151b13 401 },
e6c4ac7b 402 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
10151b13 403 },
716d413c 404 [AV_PIX_FMT_NV12] = {
bcbd9a14 405 .name = "nv12",
4a59eca9
TB
406 .nb_components = 3,
407 .log2_chroma_w = 1,
408 .log2_chroma_h = 1,
9b61d838 409 .comp = {
a6842670
LB
410 { 0, 0, 1, 0, 7 }, /* Y */
411 { 1, 1, 1, 0, 7 }, /* U */
412 { 1, 1, 2, 0, 7 }, /* V */
9b61d838 413 },
e6c4ac7b 414 .flags = AV_PIX_FMT_FLAG_PLANAR,
9b61d838 415 },
716d413c 416 [AV_PIX_FMT_NV21] = {
10151b13 417 .name = "nv21",
4a59eca9
TB
418 .nb_components = 3,
419 .log2_chroma_w = 1,
420 .log2_chroma_h = 1,
10151b13 421 .comp = {
4a59eca9
TB
422 { 0, 0, 1, 0, 7 }, /* Y */
423 { 1, 1, 1, 0, 7 }, /* V */
424 { 1, 1, 2, 0, 7 }, /* U */
10151b13 425 },
e6c4ac7b 426 .flags = AV_PIX_FMT_FLAG_PLANAR,
10151b13 427 },
716d413c 428 [AV_PIX_FMT_ARGB] = {
10151b13 429 .name = "argb",
4a59eca9
TB
430 .nb_components = 4,
431 .log2_chroma_w = 0,
432 .log2_chroma_h = 0,
10151b13 433 .comp = {
4a59eca9
TB
434 { 0, 3, 1, 0, 7 }, /* A */
435 { 0, 3, 2, 0, 7 }, /* R */
436 { 0, 3, 3, 0, 7 }, /* G */
437 { 0, 3, 4, 0, 7 }, /* B */
10151b13 438 },
e6c4ac7b 439 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
10151b13 440 },
716d413c 441 [AV_PIX_FMT_RGBA] = {
1e896640 442 .name = "rgba",
4a59eca9
TB
443 .nb_components = 4,
444 .log2_chroma_w = 0,
445 .log2_chroma_h = 0,
9b61d838 446 .comp = {
4a59eca9
TB
447 { 0, 3, 1, 0, 7 }, /* R */
448 { 0, 3, 2, 0, 7 }, /* G */
449 { 0, 3, 3, 0, 7 }, /* B */
450 { 0, 3, 4, 0, 7 }, /* A */
9b61d838 451 },
e6c4ac7b 452 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
9b61d838 453 },
716d413c 454 [AV_PIX_FMT_ABGR] = {
10151b13 455 .name = "abgr",
4a59eca9
TB
456 .nb_components = 4,
457 .log2_chroma_w = 0,
458 .log2_chroma_h = 0,
10151b13 459 .comp = {
4a59eca9
TB
460 { 0, 3, 1, 0, 7 }, /* A */
461 { 0, 3, 2, 0, 7 }, /* B */
462 { 0, 3, 3, 0, 7 }, /* G */
463 { 0, 3, 4, 0, 7 }, /* R */
10151b13 464 },
e6c4ac7b 465 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
10151b13 466 },
716d413c 467 [AV_PIX_FMT_BGRA] = {
10151b13 468 .name = "bgra",
4a59eca9
TB
469 .nb_components = 4,
470 .log2_chroma_w = 0,
471 .log2_chroma_h = 0,
10151b13 472 .comp = {
4a59eca9
TB
473 { 0, 3, 1, 0, 7 }, /* B */
474 { 0, 3, 2, 0, 7 }, /* G */
475 { 0, 3, 3, 0, 7 }, /* R */
476 { 0, 3, 4, 0, 7 }, /* A */
10151b13 477 },
e6c4ac7b 478 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
10151b13 479 },
716d413c 480 [AV_PIX_FMT_GRAY16BE] = {
bcbd9a14 481 .name = "gray16be",
4a59eca9
TB
482 .nb_components = 1,
483 .log2_chroma_w = 0,
484 .log2_chroma_h = 0,
9b61d838 485 .comp = {
4a59eca9 486 { 0, 1, 1, 0, 15 }, /* Y */
bcbd9a14 487 },
e6c4ac7b 488 .flags = AV_PIX_FMT_FLAG_BE,
bcbd9a14 489 },
716d413c 490 [AV_PIX_FMT_GRAY16LE] = {
bcbd9a14 491 .name = "gray16le",
4a59eca9
TB
492 .nb_components = 1,
493 .log2_chroma_w = 0,
494 .log2_chroma_h = 0,
bcbd9a14 495 .comp = {
4a59eca9 496 { 0, 1, 1, 0, 15 }, /* Y */
9b61d838
MN
497 },
498 },
716d413c 499 [AV_PIX_FMT_YUV440P] = {
10151b13 500 .name = "yuv440p",
4a59eca9
TB
501 .nb_components = 3,
502 .log2_chroma_w = 0,
503 .log2_chroma_h = 1,
10151b13 504 .comp = {
4a59eca9
TB
505 { 0, 0, 1, 0, 7 }, /* Y */
506 { 1, 0, 1, 0, 7 }, /* U */
507 { 2, 0, 1, 0, 7 }, /* V */
10151b13 508 },
e6c4ac7b 509 .flags = AV_PIX_FMT_FLAG_PLANAR,
10151b13 510 },
716d413c 511 [AV_PIX_FMT_YUVJ440P] = {
10151b13 512 .name = "yuvj440p",
4a59eca9
TB
513 .nb_components = 3,
514 .log2_chroma_w = 0,
515 .log2_chroma_h = 1,
10151b13 516 .comp = {
4a59eca9
TB
517 { 0, 0, 1, 0, 7 }, /* Y */
518 { 1, 0, 1, 0, 7 }, /* U */
519 { 2, 0, 1, 0, 7 }, /* V */
10151b13 520 },
e6c4ac7b 521 .flags = AV_PIX_FMT_FLAG_PLANAR,
10151b13 522 },
716d413c 523 [AV_PIX_FMT_YUVA420P] = {
10151b13 524 .name = "yuva420p",
4a59eca9
TB
525 .nb_components = 4,
526 .log2_chroma_w = 1,
527 .log2_chroma_h = 1,
10151b13 528 .comp = {
4a59eca9
TB
529 { 0, 0, 1, 0, 7 }, /* Y */
530 { 1, 0, 1, 0, 7 }, /* U */
6d5600e8
LB
531 { 2, 0, 1, 0, 7 }, /* V */
532 { 3, 0, 1, 0, 7 }, /* A */
533 },
e6c4ac7b 534 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
6d5600e8
LB
535 },
536 [AV_PIX_FMT_YUVA422P] = {
537 .name = "yuva422p",
538 .nb_components = 4,
539 .log2_chroma_w = 1,
540 .log2_chroma_h = 0,
541 .comp = {
542 { 0, 0, 1, 0, 7 }, /* Y */
543 { 1, 0, 1, 0, 7 }, /* U */
544 { 2, 0, 1, 0, 7 }, /* V */
545 { 3, 0, 1, 0, 7 }, /* A */
546 },
e6c4ac7b 547 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
6d5600e8
LB
548 },
549 [AV_PIX_FMT_YUVA444P] = {
550 .name = "yuva444p",
551 .nb_components = 4,
552 .log2_chroma_w = 0,
553 .log2_chroma_h = 0,
554 .comp = {
555 { 0, 0, 1, 0, 7 }, /* Y */
556 { 1, 0, 1, 0, 7 }, /* U */
4a59eca9
TB
557 { 2, 0, 1, 0, 7 }, /* V */
558 { 3, 0, 1, 0, 7 }, /* A */
10151b13 559 },
e6c4ac7b 560 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
10151b13 561 },
7658295b
LB
562 [AV_PIX_FMT_YUVA420P9BE] = {
563 .name = "yuva420p9be",
564 .nb_components = 4,
565 .log2_chroma_w = 1,
566 .log2_chroma_h = 1,
567 .comp = {
568 { 0, 1, 1, 0, 8 }, /* Y */
569 { 1, 1, 1, 0, 8 }, /* U */
570 { 2, 1, 1, 0, 8 }, /* V */
571 { 3, 1, 1, 0, 8 }, /* A */
572 },
e6c4ac7b 573 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
7658295b
LB
574 },
575 [AV_PIX_FMT_YUVA420P9LE] = {
576 .name = "yuva420p9le",
577 .nb_components = 4,
578 .log2_chroma_w = 1,
579 .log2_chroma_h = 1,
580 .comp = {
581 { 0, 1, 1, 0, 8 }, /* Y */
582 { 1, 1, 1, 0, 8 }, /* U */
583 { 2, 1, 1, 0, 8 }, /* V */
584 { 3, 1, 1, 0, 8 }, /* A */
585 },
e6c4ac7b 586 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
587 },
588 [AV_PIX_FMT_YUVA422P9BE] = {
589 .name = "yuva422p9be",
590 .nb_components = 4,
591 .log2_chroma_w = 1,
592 .log2_chroma_h = 0,
593 .comp = {
594 { 0, 1, 1, 0, 8 }, /* Y */
595 { 1, 1, 1, 0, 8 }, /* U */
596 { 2, 1, 1, 0, 8 }, /* V */
597 { 3, 1, 1, 0, 8 }, /* A */
598 },
e6c4ac7b 599 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
600 },
601 [AV_PIX_FMT_YUVA422P9LE] = {
602 .name = "yuva422p9le",
603 .nb_components = 4,
604 .log2_chroma_w = 1,
605 .log2_chroma_h = 0,
606 .comp = {
607 { 0, 1, 1, 0, 8 }, /* Y */
608 { 1, 1, 1, 0, 8 }, /* U */
609 { 2, 1, 1, 0, 8 }, /* V */
610 { 3, 1, 1, 0, 8 }, /* A */
611 },
e6c4ac7b 612 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
613 },
614 [AV_PIX_FMT_YUVA444P9BE] = {
615 .name = "yuva444p9be",
616 .nb_components = 4,
617 .log2_chroma_w = 0,
618 .log2_chroma_h = 0,
619 .comp = {
620 { 0, 1, 1, 0, 8 }, /* Y */
621 { 1, 1, 1, 0, 8 }, /* U */
622 { 2, 1, 1, 0, 8 }, /* V */
623 { 3, 1, 1, 0, 8 }, /* A */
624 },
e6c4ac7b 625 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
626 },
627 [AV_PIX_FMT_YUVA444P9LE] = {
628 .name = "yuva444p9le",
629 .nb_components = 4,
630 .log2_chroma_w = 0,
631 .log2_chroma_h = 0,
632 .comp = {
633 { 0, 1, 1, 0, 8 }, /* Y */
634 { 1, 1, 1, 0, 8 }, /* U */
635 { 2, 1, 1, 0, 8 }, /* V */
636 { 3, 1, 1, 0, 8 }, /* A */
637 },
e6c4ac7b 638 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
639 },
640 [AV_PIX_FMT_YUVA420P10BE] = {
641 .name = "yuva420p10be",
642 .nb_components = 4,
643 .log2_chroma_w = 1,
644 .log2_chroma_h = 1,
645 .comp = {
646 { 0, 1, 1, 0, 9 }, /* Y */
647 { 1, 1, 1, 0, 9 }, /* U */
648 { 2, 1, 1, 0, 9 }, /* V */
649 { 3, 1, 1, 0, 9 }, /* A */
650 },
e6c4ac7b 651 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
652 },
653 [AV_PIX_FMT_YUVA420P10LE] = {
654 .name = "yuva420p10le",
655 .nb_components = 4,
656 .log2_chroma_w = 1,
657 .log2_chroma_h = 1,
658 .comp = {
b519298a
PM
659 { 0, 1, 1, 0, 9 }, /* Y */
660 { 1, 1, 1, 0, 9 }, /* U */
661 { 2, 1, 1, 0, 9 }, /* V */
662 { 3, 1, 1, 0, 9 }, /* A */
7658295b 663 },
e6c4ac7b 664 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
665 },
666 [AV_PIX_FMT_YUVA422P10BE] = {
667 .name = "yuva422p10be",
668 .nb_components = 4,
669 .log2_chroma_w = 1,
670 .log2_chroma_h = 0,
671 .comp = {
b519298a
PM
672 { 0, 1, 1, 0, 9 }, /* Y */
673 { 1, 1, 1, 0, 9 }, /* U */
674 { 2, 1, 1, 0, 9 }, /* V */
675 { 3, 1, 1, 0, 9 }, /* A */
7658295b 676 },
e6c4ac7b 677 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
678 },
679 [AV_PIX_FMT_YUVA422P10LE] = {
680 .name = "yuva422p10le",
681 .nb_components = 4,
682 .log2_chroma_w = 1,
683 .log2_chroma_h = 0,
684 .comp = {
b519298a
PM
685 { 0, 1, 1, 0, 9 }, /* Y */
686 { 1, 1, 1, 0, 9 }, /* U */
687 { 2, 1, 1, 0, 9 }, /* V */
688 { 3, 1, 1, 0, 9 }, /* A */
7658295b 689 },
e6c4ac7b 690 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
691 },
692 [AV_PIX_FMT_YUVA444P10BE] = {
693 .name = "yuva444p10be",
694 .nb_components = 4,
695 .log2_chroma_w = 0,
696 .log2_chroma_h = 0,
697 .comp = {
b519298a
PM
698 { 0, 1, 1, 0, 9 }, /* Y */
699 { 1, 1, 1, 0, 9 }, /* U */
700 { 2, 1, 1, 0, 9 }, /* V */
701 { 3, 1, 1, 0, 9 }, /* A */
7658295b 702 },
e6c4ac7b 703 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
704 },
705 [AV_PIX_FMT_YUVA444P10LE] = {
706 .name = "yuva444p10le",
707 .nb_components = 4,
708 .log2_chroma_w = 0,
709 .log2_chroma_h = 0,
710 .comp = {
b519298a
PM
711 { 0, 1, 1, 0, 9 }, /* Y */
712 { 1, 1, 1, 0, 9 }, /* U */
713 { 2, 1, 1, 0, 9 }, /* V */
714 { 3, 1, 1, 0, 9 }, /* A */
7658295b 715 },
e6c4ac7b 716 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
717 },
718 [AV_PIX_FMT_YUVA420P16BE] = {
719 .name = "yuva420p16be",
720 .nb_components = 4,
721 .log2_chroma_w = 1,
722 .log2_chroma_h = 1,
723 .comp = {
724 { 0, 1, 1, 0, 15 }, /* Y */
725 { 1, 1, 1, 0, 15 }, /* U */
726 { 2, 1, 1, 0, 15 }, /* V */
727 { 3, 1, 1, 0, 15 }, /* A */
728 },
e6c4ac7b 729 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
730 },
731 [AV_PIX_FMT_YUVA420P16LE] = {
732 .name = "yuva420p16le",
733 .nb_components = 4,
734 .log2_chroma_w = 1,
735 .log2_chroma_h = 1,
736 .comp = {
737 { 0, 1, 1, 0, 15 }, /* Y */
738 { 1, 1, 1, 0, 15 }, /* U */
739 { 2, 1, 1, 0, 15 }, /* V */
740 { 3, 1, 1, 0, 15 }, /* A */
741 },
e6c4ac7b 742 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
743 },
744 [AV_PIX_FMT_YUVA422P16BE] = {
745 .name = "yuva422p16be",
746 .nb_components = 4,
747 .log2_chroma_w = 1,
748 .log2_chroma_h = 0,
749 .comp = {
750 { 0, 1, 1, 0, 15 }, /* Y */
751 { 1, 1, 1, 0, 15 }, /* U */
752 { 2, 1, 1, 0, 15 }, /* V */
753 { 3, 1, 1, 0, 15 }, /* A */
754 },
e6c4ac7b 755 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
756 },
757 [AV_PIX_FMT_YUVA422P16LE] = {
758 .name = "yuva422p16le",
759 .nb_components = 4,
760 .log2_chroma_w = 1,
761 .log2_chroma_h = 0,
762 .comp = {
763 { 0, 1, 1, 0, 15 }, /* Y */
764 { 1, 1, 1, 0, 15 }, /* U */
765 { 2, 1, 1, 0, 15 }, /* V */
766 { 3, 1, 1, 0, 15 }, /* A */
767 },
e6c4ac7b 768 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
769 },
770 [AV_PIX_FMT_YUVA444P16BE] = {
771 .name = "yuva444p16be",
772 .nb_components = 4,
773 .log2_chroma_w = 0,
774 .log2_chroma_h = 0,
775 .comp = {
776 { 0, 1, 1, 0, 15 }, /* Y */
777 { 1, 1, 1, 0, 15 }, /* U */
778 { 2, 1, 1, 0, 15 }, /* V */
779 { 3, 1, 1, 0, 15 }, /* A */
780 },
e6c4ac7b 781 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b
LB
782 },
783 [AV_PIX_FMT_YUVA444P16LE] = {
784 .name = "yuva444p16le",
785 .nb_components = 4,
786 .log2_chroma_w = 0,
787 .log2_chroma_h = 0,
788 .comp = {
789 { 0, 1, 1, 0, 15 }, /* Y */
790 { 1, 1, 1, 0, 15 }, /* U */
791 { 2, 1, 1, 0, 15 }, /* V */
792 { 3, 1, 1, 0, 15 }, /* A */
793 },
e6c4ac7b 794 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
7658295b 795 },
a0ad5d01 796#if FF_API_VDPAU
716d413c 797 [AV_PIX_FMT_VDPAU_H264] = {
3fa70a3b
SS
798 .name = "vdpau_h264",
799 .log2_chroma_w = 1,
800 .log2_chroma_h = 1,
e6c4ac7b 801 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 802 },
716d413c 803 [AV_PIX_FMT_VDPAU_MPEG1] = {
3fa70a3b
SS
804 .name = "vdpau_mpeg1",
805 .log2_chroma_w = 1,
806 .log2_chroma_h = 1,
e6c4ac7b 807 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 808 },
716d413c 809 [AV_PIX_FMT_VDPAU_MPEG2] = {
3fa70a3b
SS
810 .name = "vdpau_mpeg2",
811 .log2_chroma_w = 1,
812 .log2_chroma_h = 1,
e6c4ac7b 813 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 814 },
716d413c 815 [AV_PIX_FMT_VDPAU_WMV3] = {
3fa70a3b
SS
816 .name = "vdpau_wmv3",
817 .log2_chroma_w = 1,
818 .log2_chroma_h = 1,
e6c4ac7b 819 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 820 },
716d413c 821 [AV_PIX_FMT_VDPAU_VC1] = {
3fa70a3b
SS
822 .name = "vdpau_vc1",
823 .log2_chroma_w = 1,
824 .log2_chroma_h = 1,
e6c4ac7b 825 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 826 },
716d413c 827 [AV_PIX_FMT_VDPAU_MPEG4] = {
dd6308ad
CEH
828 .name = "vdpau_mpeg4",
829 .log2_chroma_w = 1,
830 .log2_chroma_h = 1,
e6c4ac7b 831 .flags = AV_PIX_FMT_FLAG_HWACCEL,
dd6308ad 832 },
a0ad5d01 833#endif
716d413c 834 [AV_PIX_FMT_RGB48BE] = {
1e896640 835 .name = "rgb48be",
4a59eca9
TB
836 .nb_components = 3,
837 .log2_chroma_w = 0,
838 .log2_chroma_h = 0,
9b61d838 839 .comp = {
4a59eca9
TB
840 { 0, 5, 1, 0, 15 }, /* R */
841 { 0, 5, 3, 0, 15 }, /* G */
842 { 0, 5, 5, 0, 15 }, /* B */
9b61d838 843 },
e6c4ac7b 844 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
9b61d838 845 },
716d413c 846 [AV_PIX_FMT_RGB48LE] = {
bcbd9a14 847 .name = "rgb48le",
4a59eca9
TB
848 .nb_components = 3,
849 .log2_chroma_w = 0,
850 .log2_chroma_h = 0,
9b61d838 851 .comp = {
4a59eca9
TB
852 { 0, 5, 1, 0, 15 }, /* R */
853 { 0, 5, 3, 0, 15 }, /* G */
854 { 0, 5, 5, 0, 15 }, /* B */
9b61d838 855 },
e6c4ac7b 856 .flags = AV_PIX_FMT_FLAG_RGB,
9b61d838 857 },
716d413c 858 [AV_PIX_FMT_RGB565BE] = {
1e896640 859 .name = "rgb565be",
4a59eca9
TB
860 .nb_components = 3,
861 .log2_chroma_w = 0,
862 .log2_chroma_h = 0,
9b61d838 863 .comp = {
4a59eca9
TB
864 { 0, 1, 0, 3, 4 }, /* R */
865 { 0, 1, 1, 5, 5 }, /* G */
866 { 0, 1, 1, 0, 4 }, /* B */
9b61d838 867 },
e6c4ac7b 868 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
9b61d838 869 },
716d413c 870 [AV_PIX_FMT_RGB565LE] = {
bcbd9a14 871 .name = "rgb565le",
4a59eca9
TB
872 .nb_components = 3,
873 .log2_chroma_w = 0,
874 .log2_chroma_h = 0,
9b61d838 875 .comp = {
4a59eca9
TB
876 { 0, 1, 2, 3, 4 }, /* R */
877 { 0, 1, 1, 5, 5 }, /* G */
878 { 0, 1, 1, 0, 4 }, /* B */
9b61d838 879 },
e6c4ac7b 880 .flags = AV_PIX_FMT_FLAG_RGB,
9b61d838 881 },
716d413c 882 [AV_PIX_FMT_RGB555BE] = {
10151b13 883 .name = "rgb555be",
4a59eca9
TB
884 .nb_components = 3,
885 .log2_chroma_w = 0,
886 .log2_chroma_h = 0,
10151b13 887 .comp = {
4a59eca9
TB
888 { 0, 1, 0, 2, 4 }, /* R */
889 { 0, 1, 1, 5, 4 }, /* G */
890 { 0, 1, 1, 0, 4 }, /* B */
10151b13 891 },
e6c4ac7b 892 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
10151b13 893 },
716d413c 894 [AV_PIX_FMT_RGB555LE] = {
10151b13 895 .name = "rgb555le",
4a59eca9
TB
896 .nb_components = 3,
897 .log2_chroma_w = 0,
898 .log2_chroma_h = 0,
10151b13 899 .comp = {
4a59eca9
TB
900 { 0, 1, 2, 2, 4 }, /* R */
901 { 0, 1, 1, 5, 4 }, /* G */
902 { 0, 1, 1, 0, 4 }, /* B */
10151b13 903 },
e6c4ac7b 904 .flags = AV_PIX_FMT_FLAG_RGB,
10151b13 905 },
716d413c 906 [AV_PIX_FMT_RGB444BE] = {
2b7cf167 907 .name = "rgb444be",
4a59eca9
TB
908 .nb_components = 3,
909 .log2_chroma_w = 0,
910 .log2_chroma_h = 0,
2b7cf167 911 .comp = {
4a59eca9
TB
912 { 0, 1, 0, 0, 3 }, /* R */
913 { 0, 1, 1, 4, 3 }, /* G */
914 { 0, 1, 1, 0, 3 }, /* B */
2b7cf167 915 },
e6c4ac7b 916 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
2b7cf167 917 },
716d413c 918 [AV_PIX_FMT_RGB444LE] = {
2b7cf167 919 .name = "rgb444le",
4a59eca9
TB
920 .nb_components = 3,
921 .log2_chroma_w = 0,
922 .log2_chroma_h = 0,
2b7cf167 923 .comp = {
4a59eca9
TB
924 { 0, 1, 2, 0, 3 }, /* R */
925 { 0, 1, 1, 4, 3 }, /* G */
926 { 0, 1, 1, 0, 3 }, /* B */
2b7cf167 927 },
e6c4ac7b 928 .flags = AV_PIX_FMT_FLAG_RGB,
2b7cf167 929 },
716d413c 930 [AV_PIX_FMT_BGR48BE] = {
73389754 931 .name = "bgr48be",
4a59eca9
TB
932 .nb_components = 3,
933 .log2_chroma_w = 0,
934 .log2_chroma_h = 0,
73389754 935 .comp = {
4a59eca9
TB
936 { 0, 5, 1, 0, 15 }, /* B */
937 { 0, 5, 3, 0, 15 }, /* G */
938 { 0, 5, 5, 0, 15 }, /* R */
73389754 939 },
e6c4ac7b 940 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
73389754 941 },
716d413c 942 [AV_PIX_FMT_BGR48LE] = {
73389754 943 .name = "bgr48le",
4a59eca9
TB
944 .nb_components = 3,
945 .log2_chroma_w = 0,
946 .log2_chroma_h = 0,
73389754 947 .comp = {
4a59eca9
TB
948 { 0, 5, 1, 0, 15 }, /* B */
949 { 0, 5, 3, 0, 15 }, /* G */
950 { 0, 5, 5, 0, 15 }, /* R */
73389754 951 },
e6c4ac7b 952 .flags = AV_PIX_FMT_FLAG_RGB,
73389754 953 },
716d413c 954 [AV_PIX_FMT_BGR565BE] = {
10151b13 955 .name = "bgr565be",
4a59eca9
TB
956 .nb_components = 3,
957 .log2_chroma_w = 0,
958 .log2_chroma_h = 0,
10151b13 959 .comp = {
4a59eca9
TB
960 { 0, 1, 0, 3, 4 }, /* B */
961 { 0, 1, 1, 5, 5 }, /* G */
962 { 0, 1, 1, 0, 4 }, /* R */
10151b13 963 },
e6c4ac7b 964 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
10151b13 965 },
716d413c 966 [AV_PIX_FMT_BGR565LE] = {
10151b13 967 .name = "bgr565le",
4a59eca9
TB
968 .nb_components = 3,
969 .log2_chroma_w = 0,
970 .log2_chroma_h = 0,
10151b13 971 .comp = {
4a59eca9
TB
972 { 0, 1, 2, 3, 4 }, /* B */
973 { 0, 1, 1, 5, 5 }, /* G */
974 { 0, 1, 1, 0, 4 }, /* R */
10151b13 975 },
e6c4ac7b 976 .flags = AV_PIX_FMT_FLAG_RGB,
10151b13 977 },
716d413c 978 [AV_PIX_FMT_BGR555BE] = {
10151b13 979 .name = "bgr555be",
4a59eca9
TB
980 .nb_components = 3,
981 .log2_chroma_w = 0,
982 .log2_chroma_h = 0,
10151b13 983 .comp = {
4a59eca9
TB
984 { 0, 1, 0, 2, 4 }, /* B */
985 { 0, 1, 1, 5, 4 }, /* G */
986 { 0, 1, 1, 0, 4 }, /* R */
10151b13 987 },
e6c4ac7b 988 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
10151b13 989 },
716d413c 990 [AV_PIX_FMT_BGR555LE] = {
10151b13 991 .name = "bgr555le",
4a59eca9
TB
992 .nb_components = 3,
993 .log2_chroma_w = 0,
994 .log2_chroma_h = 0,
10151b13 995 .comp = {
4a59eca9
TB
996 { 0, 1, 2, 2, 4 }, /* B */
997 { 0, 1, 1, 5, 4 }, /* G */
998 { 0, 1, 1, 0, 4 }, /* R */
10151b13 999 },
e6c4ac7b 1000 .flags = AV_PIX_FMT_FLAG_RGB,
10151b13 1001 },
716d413c 1002 [AV_PIX_FMT_BGR444BE] = {
2b7cf167 1003 .name = "bgr444be",
4a59eca9
TB
1004 .nb_components = 3,
1005 .log2_chroma_w = 0,
1006 .log2_chroma_h = 0,
2b7cf167 1007 .comp = {
4a59eca9
TB
1008 { 0, 1, 0, 0, 3 }, /* B */
1009 { 0, 1, 1, 4, 3 }, /* G */
1010 { 0, 1, 1, 0, 3 }, /* R */
2b7cf167 1011 },
e6c4ac7b 1012 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
2b7cf167 1013 },
716d413c 1014 [AV_PIX_FMT_BGR444LE] = {
2b7cf167 1015 .name = "bgr444le",
4a59eca9
TB
1016 .nb_components = 3,
1017 .log2_chroma_w = 0,
1018 .log2_chroma_h = 0,
2b7cf167 1019 .comp = {
4a59eca9
TB
1020 { 0, 1, 2, 0, 3 }, /* B */
1021 { 0, 1, 1, 4, 3 }, /* G */
1022 { 0, 1, 1, 0, 3 }, /* R */
2b7cf167 1023 },
e6c4ac7b 1024 .flags = AV_PIX_FMT_FLAG_RGB,
2b7cf167 1025 },
716d413c 1026 [AV_PIX_FMT_VAAPI_MOCO] = {
3fa70a3b
SS
1027 .name = "vaapi_moco",
1028 .log2_chroma_w = 1,
1029 .log2_chroma_h = 1,
e6c4ac7b 1030 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 1031 },
716d413c 1032 [AV_PIX_FMT_VAAPI_IDCT] = {
3fa70a3b
SS
1033 .name = "vaapi_idct",
1034 .log2_chroma_w = 1,
1035 .log2_chroma_h = 1,
e6c4ac7b 1036 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 1037 },
716d413c 1038 [AV_PIX_FMT_VAAPI_VLD] = {
3fa70a3b
SS
1039 .name = "vaapi_vld",
1040 .log2_chroma_w = 1,
1041 .log2_chroma_h = 1,
e6c4ac7b 1042 .flags = AV_PIX_FMT_FLAG_HWACCEL,
3fa70a3b 1043 },
716d413c 1044 [AV_PIX_FMT_VDA_VLD] = {
ac3dbb4d
SZ
1045 .name = "vda_vld",
1046 .log2_chroma_w = 1,
1047 .log2_chroma_h = 1,
e6c4ac7b 1048 .flags = AV_PIX_FMT_FLAG_HWACCEL,
ac3dbb4d 1049 },
716d413c 1050 [AV_PIX_FMT_YUV420P9LE] = {
42239ced 1051 .name = "yuv420p9le",
4a59eca9
TB
1052 .nb_components = 3,
1053 .log2_chroma_w = 1,
1054 .log2_chroma_h = 1,
42239ced 1055 .comp = {
4a59eca9
TB
1056 { 0, 1, 1, 0, 8 }, /* Y */
1057 { 1, 1, 1, 0, 8 }, /* U */
1058 { 2, 1, 1, 0, 8 }, /* V */
42239ced 1059 },
e6c4ac7b 1060 .flags = AV_PIX_FMT_FLAG_PLANAR,
42239ced 1061 },
716d413c 1062 [AV_PIX_FMT_YUV420P9BE] = {
42239ced 1063 .name = "yuv420p9be",
4a59eca9
TB
1064 .nb_components = 3,
1065 .log2_chroma_w = 1,
1066 .log2_chroma_h = 1,
42239ced 1067 .comp = {
4a59eca9
TB
1068 { 0, 1, 1, 0, 8 }, /* Y */
1069 { 1, 1, 1, 0, 8 }, /* U */
1070 { 2, 1, 1, 0, 8 }, /* V */
42239ced 1071 },
e6c4ac7b 1072 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
42239ced 1073 },
716d413c 1074 [AV_PIX_FMT_YUV420P10LE] = {
42239ced 1075 .name = "yuv420p10le",
4a59eca9
TB
1076 .nb_components = 3,
1077 .log2_chroma_w = 1,
1078 .log2_chroma_h = 1,
42239ced 1079 .comp = {
4a59eca9
TB
1080 { 0, 1, 1, 0, 9 }, /* Y */
1081 { 1, 1, 1, 0, 9 }, /* U */
1082 { 2, 1, 1, 0, 9 }, /* V */
42239ced 1083 },
e6c4ac7b 1084 .flags = AV_PIX_FMT_FLAG_PLANAR,
42239ced 1085 },
716d413c 1086 [AV_PIX_FMT_YUV420P10BE] = {
42239ced 1087 .name = "yuv420p10be",
4a59eca9
TB
1088 .nb_components = 3,
1089 .log2_chroma_w = 1,
1090 .log2_chroma_h = 1,
42239ced 1091 .comp = {
4a59eca9
TB
1092 { 0, 1, 1, 0, 9 }, /* Y */
1093 { 1, 1, 1, 0, 9 }, /* U */
1094 { 2, 1, 1, 0, 9 }, /* V */
42239ced 1095 },
e6c4ac7b 1096 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
42239ced 1097 },
716d413c 1098 [AV_PIX_FMT_YUV420P16LE] = {
35f6c154 1099 .name = "yuv420p16le",
4a59eca9
TB
1100 .nb_components = 3,
1101 .log2_chroma_w = 1,
1102 .log2_chroma_h = 1,
75801da5 1103 .comp = {
4a59eca9
TB
1104 { 0, 1, 1, 0, 15 }, /* Y */
1105 { 1, 1, 1, 0, 15 }, /* U */
1106 { 2, 1, 1, 0, 15 }, /* V */
75801da5 1107 },
e6c4ac7b 1108 .flags = AV_PIX_FMT_FLAG_PLANAR,
75801da5 1109 },
716d413c 1110 [AV_PIX_FMT_YUV420P16BE] = {
35f6c154 1111 .name = "yuv420p16be",
4a59eca9
TB
1112 .nb_components = 3,
1113 .log2_chroma_w = 1,
1114 .log2_chroma_h = 1,
75801da5 1115 .comp = {
4a59eca9
TB
1116 { 0, 1, 1, 0, 15 }, /* Y */
1117 { 1, 1, 1, 0, 15 }, /* U */
1118 { 2, 1, 1, 0, 15 }, /* V */
75801da5 1119 },
e6c4ac7b 1120 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
75801da5 1121 },
716d413c 1122 [AV_PIX_FMT_YUV422P9LE] = {
dc49bf12 1123 .name = "yuv422p9le",
4a59eca9
TB
1124 .nb_components = 3,
1125 .log2_chroma_w = 1,
1126 .log2_chroma_h = 0,
dc49bf12 1127 .comp = {
4a59eca9
TB
1128 { 0, 1, 1, 0, 8 }, /* Y */
1129 { 1, 1, 1, 0, 8 }, /* U */
1130 { 2, 1, 1, 0, 8 }, /* V */
dc49bf12 1131 },
e6c4ac7b 1132 .flags = AV_PIX_FMT_FLAG_PLANAR,
dc49bf12 1133 },
716d413c 1134 [AV_PIX_FMT_YUV422P9BE] = {
dc49bf12 1135 .name = "yuv422p9be",
4a59eca9
TB
1136 .nb_components = 3,
1137 .log2_chroma_w = 1,
1138 .log2_chroma_h = 0,
dc49bf12 1139 .comp = {
a6842670
LB
1140 { 0, 1, 1, 0, 8 }, /* Y */
1141 { 1, 1, 1, 0, 8 }, /* U */
1142 { 2, 1, 1, 0, 8 }, /* V */
dc49bf12 1143 },
e6c4ac7b 1144 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
dc49bf12 1145 },
716d413c 1146 [AV_PIX_FMT_YUV422P10LE] = {
5c511ad4 1147 .name = "yuv422p10le",
4a59eca9
TB
1148 .nb_components = 3,
1149 .log2_chroma_w = 1,
1150 .log2_chroma_h = 0,
5c511ad4 1151 .comp = {
4a59eca9
TB
1152 { 0, 1, 1, 0, 9 }, /* Y */
1153 { 1, 1, 1, 0, 9 }, /* U */
1154 { 2, 1, 1, 0, 9 }, /* V */
5c511ad4 1155 },
e6c4ac7b 1156 .flags = AV_PIX_FMT_FLAG_PLANAR,
5c511ad4 1157 },
716d413c 1158 [AV_PIX_FMT_YUV422P10BE] = {
5c511ad4 1159 .name = "yuv422p10be",
4a59eca9
TB
1160 .nb_components = 3,
1161 .log2_chroma_w = 1,
1162 .log2_chroma_h = 0,
5c511ad4 1163 .comp = {
4a59eca9
TB
1164 { 0, 1, 1, 0, 9 }, /* Y */
1165 { 1, 1, 1, 0, 9 }, /* U */
1166 { 2, 1, 1, 0, 9 }, /* V */
5c511ad4 1167 },
e6c4ac7b 1168 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
5c511ad4 1169 },
716d413c 1170 [AV_PIX_FMT_YUV422P16LE] = {
35f6c154 1171 .name = "yuv422p16le",
4a59eca9
TB
1172 .nb_components = 3,
1173 .log2_chroma_w = 1,
1174 .log2_chroma_h = 0,
75801da5 1175 .comp = {
4a59eca9
TB
1176 { 0, 1, 1, 0, 15 }, /* Y */
1177 { 1, 1, 1, 0, 15 }, /* U */
1178 { 2, 1, 1, 0, 15 }, /* V */
75801da5 1179 },
e6c4ac7b 1180 .flags = AV_PIX_FMT_FLAG_PLANAR,
75801da5 1181 },
716d413c 1182 [AV_PIX_FMT_YUV422P16BE] = {
35f6c154 1183 .name = "yuv422p16be",
4a59eca9
TB
1184 .nb_components = 3,
1185 .log2_chroma_w = 1,
1186 .log2_chroma_h = 0,
75801da5 1187 .comp = {
4a59eca9
TB
1188 { 0, 1, 1, 0, 15 }, /* Y */
1189 { 1, 1, 1, 0, 15 }, /* U */
1190 { 2, 1, 1, 0, 15 }, /* V */
75801da5 1191 },
e6c4ac7b 1192 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
75801da5 1193 },
716d413c 1194 [AV_PIX_FMT_YUV444P16LE] = {
35f6c154 1195 .name = "yuv444p16le",
4a59eca9
TB
1196 .nb_components = 3,
1197 .log2_chroma_w = 0,
1198 .log2_chroma_h = 0,
75801da5 1199 .comp = {
4a59eca9
TB
1200 { 0, 1, 1, 0, 15 }, /* Y */
1201 { 1, 1, 1, 0, 15 }, /* U */
1202 { 2, 1, 1, 0, 15 }, /* V */
75801da5 1203 },
e6c4ac7b 1204 .flags = AV_PIX_FMT_FLAG_PLANAR,
75801da5 1205 },
716d413c 1206 [AV_PIX_FMT_YUV444P16BE] = {
35f6c154 1207 .name = "yuv444p16be",
4a59eca9
TB
1208 .nb_components = 3,
1209 .log2_chroma_w = 0,
1210 .log2_chroma_h = 0,
75801da5 1211 .comp = {
4a59eca9
TB
1212 { 0, 1, 1, 0, 15 }, /* Y */
1213 { 1, 1, 1, 0, 15 }, /* U */
1214 { 2, 1, 1, 0, 15 }, /* V */
75801da5 1215 },
e6c4ac7b 1216 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
75801da5 1217 },
716d413c 1218 [AV_PIX_FMT_YUV444P10LE] = {
103278f7 1219 .name = "yuv444p10le",
4a59eca9
TB
1220 .nb_components = 3,
1221 .log2_chroma_w = 0,
1222 .log2_chroma_h = 0,
103278f7 1223 .comp = {
4a59eca9
TB
1224 { 0, 1, 1, 0, 9 }, /* Y */
1225 { 1, 1, 1, 0, 9 }, /* U */
1226 { 2, 1, 1, 0, 9 }, /* V */
103278f7 1227 },
e6c4ac7b 1228 .flags = AV_PIX_FMT_FLAG_PLANAR,
103278f7 1229 },
716d413c 1230 [AV_PIX_FMT_YUV444P10BE] = {
103278f7 1231 .name = "yuv444p10be",
4a59eca9
TB
1232 .nb_components = 3,
1233 .log2_chroma_w = 0,
1234 .log2_chroma_h = 0,
103278f7 1235 .comp = {
4a59eca9
TB
1236 { 0, 1, 1, 0, 9 }, /* Y */
1237 { 1, 1, 1, 0, 9 }, /* U */
1238 { 2, 1, 1, 0, 9 }, /* V */
103278f7 1239 },
e6c4ac7b 1240 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
103278f7 1241 },
716d413c 1242 [AV_PIX_FMT_YUV444P9LE] = {
103278f7 1243 .name = "yuv444p9le",
4a59eca9
TB
1244 .nb_components = 3,
1245 .log2_chroma_w = 0,
1246 .log2_chroma_h = 0,
103278f7 1247 .comp = {
4a59eca9
TB
1248 { 0, 1, 1, 0, 8 }, /* Y */
1249 { 1, 1, 1, 0, 8 }, /* U */
1250 { 2, 1, 1, 0, 8 }, /* V */
103278f7 1251 },
e6c4ac7b 1252 .flags = AV_PIX_FMT_FLAG_PLANAR,
103278f7 1253 },
716d413c 1254 [AV_PIX_FMT_YUV444P9BE] = {
103278f7 1255 .name = "yuv444p9be",
4a59eca9
TB
1256 .nb_components = 3,
1257 .log2_chroma_w = 0,
1258 .log2_chroma_h = 0,
103278f7 1259 .comp = {
4a59eca9
TB
1260 { 0, 1, 1, 0, 8 }, /* Y */
1261 { 1, 1, 1, 0, 8 }, /* U */
1262 { 2, 1, 1, 0, 8 }, /* V */
103278f7 1263 },
e6c4ac7b 1264 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
103278f7 1265 },
716d413c 1266 [AV_PIX_FMT_DXVA2_VLD] = {
92c6a099
LA
1267 .name = "dxva2_vld",
1268 .log2_chroma_w = 1,
1269 .log2_chroma_h = 1,
e6c4ac7b 1270 .flags = AV_PIX_FMT_FLAG_HWACCEL,
92c6a099 1271 },
716d413c 1272 [AV_PIX_FMT_Y400A] = {
4744f896 1273 .name = "y400a",
4a59eca9 1274 .nb_components = 2,
4744f896 1275 .comp = {
4a59eca9
TB
1276 { 0, 1, 1, 0, 7 }, /* Y */
1277 { 0, 1, 2, 0, 7 }, /* A */
4744f896 1278 },
e6c4ac7b 1279 .flags = AV_PIX_FMT_FLAG_ALPHA,
4744f896 1280 },
716d413c 1281 [AV_PIX_FMT_GBRP] = {
bd97b2e1 1282 .name = "gbrp",
4a59eca9
TB
1283 .nb_components = 3,
1284 .log2_chroma_w = 0,
1285 .log2_chroma_h = 0,
bd97b2e1 1286 .comp = {
4a59eca9
TB
1287 { 0, 0, 1, 0, 7 }, /* G */
1288 { 1, 0, 1, 0, 7 }, /* B */
1289 { 2, 0, 1, 0, 7 }, /* R */
bd97b2e1 1290 },
e6c4ac7b 1291 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1292 },
716d413c 1293 [AV_PIX_FMT_GBRP9LE] = {
bd97b2e1 1294 .name = "gbrp9le",
4a59eca9
TB
1295 .nb_components = 3,
1296 .log2_chroma_w = 0,
1297 .log2_chroma_h = 0,
bd97b2e1 1298 .comp = {
4a59eca9
TB
1299 { 0, 1, 1, 0, 8 }, /* G */
1300 { 1, 1, 1, 0, 8 }, /* B */
1301 { 2, 1, 1, 0, 8 }, /* R */
bd97b2e1 1302 },
e6c4ac7b 1303 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1304 },
716d413c 1305 [AV_PIX_FMT_GBRP9BE] = {
bd97b2e1 1306 .name = "gbrp9be",
4a59eca9
TB
1307 .nb_components = 3,
1308 .log2_chroma_w = 0,
1309 .log2_chroma_h = 0,
bd97b2e1 1310 .comp = {
4a59eca9
TB
1311 { 0, 1, 1, 0, 8 }, /* G */
1312 { 1, 1, 1, 0, 8 }, /* B */
1313 { 2, 1, 1, 0, 8 }, /* R */
bd97b2e1 1314 },
e6c4ac7b 1315 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1316 },
716d413c 1317 [AV_PIX_FMT_GBRP10LE] = {
bd97b2e1 1318 .name = "gbrp10le",
4a59eca9
TB
1319 .nb_components = 3,
1320 .log2_chroma_w = 0,
1321 .log2_chroma_h = 0,
bd97b2e1 1322 .comp = {
4a59eca9
TB
1323 { 0, 1, 1, 0, 9 }, /* G */
1324 { 1, 1, 1, 0, 9 }, /* B */
1325 { 2, 1, 1, 0, 9 }, /* R */
bd97b2e1 1326 },
e6c4ac7b 1327 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1328 },
716d413c 1329 [AV_PIX_FMT_GBRP10BE] = {
bd97b2e1 1330 .name = "gbrp10be",
4a59eca9
TB
1331 .nb_components = 3,
1332 .log2_chroma_w = 0,
1333 .log2_chroma_h = 0,
bd97b2e1 1334 .comp = {
4a59eca9
TB
1335 { 0, 1, 1, 0, 9 }, /* G */
1336 { 1, 1, 1, 0, 9 }, /* B */
1337 { 2, 1, 1, 0, 9 }, /* R */
bd97b2e1 1338 },
e6c4ac7b 1339 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1340 },
716d413c 1341 [AV_PIX_FMT_GBRP16LE] = {
bd97b2e1 1342 .name = "gbrp16le",
4a59eca9
TB
1343 .nb_components = 3,
1344 .log2_chroma_w = 0,
1345 .log2_chroma_h = 0,
bd97b2e1 1346 .comp = {
4a59eca9
TB
1347 { 0, 1, 1, 0, 15 }, /* G */
1348 { 1, 1, 1, 0, 15 }, /* B */
1349 { 2, 1, 1, 0, 15 }, /* R */
bd97b2e1 1350 },
e6c4ac7b 1351 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1352 },
716d413c 1353 [AV_PIX_FMT_GBRP16BE] = {
bd97b2e1 1354 .name = "gbrp16be",
4a59eca9
TB
1355 .nb_components = 3,
1356 .log2_chroma_w = 0,
1357 .log2_chroma_h = 0,
bd97b2e1 1358 .comp = {
4a59eca9
TB
1359 { 0, 1, 1, 0, 15 }, /* G */
1360 { 1, 1, 1, 0, 15 }, /* B */
1361 { 2, 1, 1, 0, 15 }, /* R */
bd97b2e1 1362 },
e6c4ac7b 1363 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1364 },
169fb94f
RDC
1365 [AV_PIX_FMT_VDPAU] = {
1366 .name = "vdpau",
1367 .log2_chroma_w = 1,
1368 .log2_chroma_h = 1,
e6c4ac7b 1369 .flags = AV_PIX_FMT_FLAG_HWACCEL,
169fb94f 1370 },
8c652645
NB
1371 [AV_PIX_FMT_XYZ12LE] = {
1372 .name = "xyz12le",
1373 .nb_components = 3,
1374 .log2_chroma_w = 0,
1375 .log2_chroma_h = 0,
1376 .comp = {
1377 { 0, 5, 1, 4, 11 }, /* X */
1378 { 0, 5, 3, 4, 11 }, /* Y */
1379 { 0, 5, 5, 4, 11 }, /* Z */
1380 },
1381 /*.flags = -- not used*/
1382 },
1383 [AV_PIX_FMT_XYZ12BE] = {
1384 .name = "xyz12be",
1385 .nb_components = 3,
1386 .log2_chroma_w = 0,
1387 .log2_chroma_h = 0,
1388 .comp = {
1389 { 0, 5, 1, 4, 11 }, /* X */
1390 { 0, 5, 3, 4, 11 }, /* Y */
1391 { 0, 5, 5, 4, 11 }, /* Z */
1392 },
e6c4ac7b 1393 .flags = AV_PIX_FMT_FLAG_BE,
8c652645 1394 },
9b61d838 1395};
5efccce2 1396
7950e519 1397FF_DISABLE_DEPRECATION_WARNINGS
716d413c 1398static enum AVPixelFormat get_pix_fmt_internal(const char *name)
80a07f6e 1399{
716d413c 1400 enum AVPixelFormat pix_fmt;
80a07f6e 1401
716d413c 1402 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
80a07f6e
SS
1403 if (av_pix_fmt_descriptors[pix_fmt].name &&
1404 !strcmp(av_pix_fmt_descriptors[pix_fmt].name, name))
1405 return pix_fmt;
1406
716d413c 1407 return AV_PIX_FMT_NONE;
80a07f6e
SS
1408}
1409
716d413c 1410const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
8f653e28 1411{
716d413c 1412 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
8f653e28
SS
1413 av_pix_fmt_descriptors[pix_fmt].name : NULL;
1414}
1415
80a07f6e
SS
1416#if HAVE_BIGENDIAN
1417# define X_NE(be, le) be
1418#else
1419# define X_NE(be, le) le
1420#endif
1421
716d413c 1422enum AVPixelFormat av_get_pix_fmt(const char *name)
80a07f6e 1423{
716d413c 1424 enum AVPixelFormat pix_fmt;
80a07f6e
SS
1425
1426 if (!strcmp(name, "rgb32"))
1427 name = X_NE("argb", "bgra");
1428 else if (!strcmp(name, "bgr32"))
1429 name = X_NE("abgr", "rgba");
1430
1431 pix_fmt = get_pix_fmt_internal(name);
716d413c 1432 if (pix_fmt == AV_PIX_FMT_NONE) {
80a07f6e
SS
1433 char name2[32];
1434
1435 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
1436 pix_fmt = get_pix_fmt_internal(name2);
1437 }
1438 return pix_fmt;
1439}
1440
5efccce2
SS
1441int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
1442{
1443 int c, bits = 0;
1444 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
1445
b8873c2a 1446 for (c = 0; c < pixdesc->nb_components; c++) {
4a59eca9
TB
1447 int s = c == 1 || c == 2 ? 0 : log2_pixels;
1448 bits += (pixdesc->comp[c].depth_minus1 + 1) << s;
5efccce2
SS
1449 }
1450
1451 return bits >> log2_pixels;
1452}
bb4afa13 1453
716d413c 1454char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt)
bb4afa13
SS
1455{
1456 /* print header */
1457 if (pix_fmt < 0) {
4a59eca9 1458 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
bb4afa13
SS
1459 } else {
1460 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
4a59eca9
TB
1461 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
1462 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
bb4afa13
SS
1463 }
1464
1465 return buf;
1466}
d2fcb356
AK
1467
1468const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1469{
1470 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1471 return NULL;
1472 return &av_pix_fmt_descriptors[pix_fmt];
1473}
1474
1475const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
1476{
1477 if (!prev)
1478 return &av_pix_fmt_descriptors[0];
1479 if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1)
1480 return prev + 1;
1481 return NULL;
1482}
1483
1484enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
1485{
1486 if (desc < av_pix_fmt_descriptors ||
1487 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
1488 return AV_PIX_FMT_NONE;
1489
1490 return desc - av_pix_fmt_descriptors;
1491}
7950e519 1492FF_ENABLE_DEPRECATION_WARNINGS
c1a02e88
LB
1493
1494int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
1495 int *h_shift, int *v_shift)
1496{
1497 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
1498 if (!desc)
1499 return AVERROR(ENOSYS);
1500 *h_shift = desc->log2_chroma_w;
1501 *v_shift = desc->log2_chroma_h;
1502
1503 return 0;
1504}
2c328a90
AK
1505
1506int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
1507{
1508 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
1509 int i, planes[4] = { 0 }, ret = 0;
1510
1511 if (!desc)
1512 return AVERROR(EINVAL);
1513
1514 for (i = 0; i < desc->nb_components; i++)
1515 planes[desc->comp[i].plane] = 1;
1516 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
1517 ret += planes[i];
1518 return ret;
1519}
74652af8
JG
1520
1521
1522enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
1523{
1524#define PIX_FMT_SWAP_ENDIANNESS(fmt) \
1525 case AV_PIX_FMT_ ## fmt ## BE: return AV_PIX_FMT_ ## fmt ## LE; \
1526 case AV_PIX_FMT_ ## fmt ## LE: return AV_PIX_FMT_ ## fmt ## BE
1527
1528 switch (pix_fmt) {
1529 PIX_FMT_SWAP_ENDIANNESS(GRAY16);
1530 PIX_FMT_SWAP_ENDIANNESS(RGB48);
1531 PIX_FMT_SWAP_ENDIANNESS(RGB565);
1532 PIX_FMT_SWAP_ENDIANNESS(RGB555);
1533 PIX_FMT_SWAP_ENDIANNESS(RGB444);
1534 PIX_FMT_SWAP_ENDIANNESS(BGR48);
1535 PIX_FMT_SWAP_ENDIANNESS(BGR565);
1536 PIX_FMT_SWAP_ENDIANNESS(BGR555);
1537 PIX_FMT_SWAP_ENDIANNESS(BGR444);
1538
1539 PIX_FMT_SWAP_ENDIANNESS(YUV420P9);
1540 PIX_FMT_SWAP_ENDIANNESS(YUV422P9);
1541 PIX_FMT_SWAP_ENDIANNESS(YUV444P9);
1542 PIX_FMT_SWAP_ENDIANNESS(YUV420P10);
1543 PIX_FMT_SWAP_ENDIANNESS(YUV422P10);
1544 PIX_FMT_SWAP_ENDIANNESS(YUV444P10);
1545 PIX_FMT_SWAP_ENDIANNESS(YUV420P16);
1546 PIX_FMT_SWAP_ENDIANNESS(YUV422P16);
1547 PIX_FMT_SWAP_ENDIANNESS(YUV444P16);
1548
1549 PIX_FMT_SWAP_ENDIANNESS(GBRP9);
1550 PIX_FMT_SWAP_ENDIANNESS(GBRP10);
1551 PIX_FMT_SWAP_ENDIANNESS(GBRP16);
1552 PIX_FMT_SWAP_ENDIANNESS(YUVA420P9);
1553 PIX_FMT_SWAP_ENDIANNESS(YUVA422P9);
1554 PIX_FMT_SWAP_ENDIANNESS(YUVA444P9);
1555 PIX_FMT_SWAP_ENDIANNESS(YUVA420P10);
1556 PIX_FMT_SWAP_ENDIANNESS(YUVA422P10);
1557 PIX_FMT_SWAP_ENDIANNESS(YUVA444P10);
1558 PIX_FMT_SWAP_ENDIANNESS(YUVA420P16);
1559 PIX_FMT_SWAP_ENDIANNESS(YUVA422P16);
1560 PIX_FMT_SWAP_ENDIANNESS(YUVA444P16);
1561
1562 PIX_FMT_SWAP_ENDIANNESS(XYZ12);
1563 default:
1564 return AV_PIX_FMT_NONE;
1565 }
1566#undef PIX_FMT_SWAP_ENDIANNESS
1567}