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