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