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