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