pixfmt: Add yuv420p12 pixel format
[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 },
85406e7a
LB
1177 [AV_PIX_FMT_YUV420P12LE] = {
1178 .name = "yuv420p12le",
1179 .nb_components = 3,
1180 .log2_chroma_w = 1,
1181 .log2_chroma_h = 1,
1182 .comp = {
1183 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1184 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1185 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1186 },
1187 .flags = AV_PIX_FMT_FLAG_PLANAR,
1188 },
1189 [AV_PIX_FMT_YUV420P12BE] = {
1190 .name = "yuv420p12be",
1191 .nb_components = 3,
1192 .log2_chroma_w = 1,
1193 .log2_chroma_h = 1,
1194 .comp = {
1195 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1196 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1197 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1198 },
1199 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1200 },
716d413c 1201 [AV_PIX_FMT_YUV420P16LE] = {
35f6c154 1202 .name = "yuv420p16le",
4a59eca9
TB
1203 .nb_components = 3,
1204 .log2_chroma_w = 1,
1205 .log2_chroma_h = 1,
75801da5 1206 .comp = {
2268db2c
VG
1207 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1208 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1209 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
75801da5 1210 },
e6c4ac7b 1211 .flags = AV_PIX_FMT_FLAG_PLANAR,
75801da5 1212 },
716d413c 1213 [AV_PIX_FMT_YUV420P16BE] = {
35f6c154 1214 .name = "yuv420p16be",
4a59eca9
TB
1215 .nb_components = 3,
1216 .log2_chroma_w = 1,
1217 .log2_chroma_h = 1,
75801da5 1218 .comp = {
2268db2c
VG
1219 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1220 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1221 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
75801da5 1222 },
e6c4ac7b 1223 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
75801da5 1224 },
716d413c 1225 [AV_PIX_FMT_YUV422P9LE] = {
dc49bf12 1226 .name = "yuv422p9le",
4a59eca9
TB
1227 .nb_components = 3,
1228 .log2_chroma_w = 1,
1229 .log2_chroma_h = 0,
dc49bf12 1230 .comp = {
2268db2c
VG
1231 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1232 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1233 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
dc49bf12 1234 },
e6c4ac7b 1235 .flags = AV_PIX_FMT_FLAG_PLANAR,
dc49bf12 1236 },
716d413c 1237 [AV_PIX_FMT_YUV422P9BE] = {
dc49bf12 1238 .name = "yuv422p9be",
4a59eca9
TB
1239 .nb_components = 3,
1240 .log2_chroma_w = 1,
1241 .log2_chroma_h = 0,
dc49bf12 1242 .comp = {
2268db2c
VG
1243 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1244 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1245 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
dc49bf12 1246 },
e6c4ac7b 1247 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
dc49bf12 1248 },
716d413c 1249 [AV_PIX_FMT_YUV422P10LE] = {
5c511ad4 1250 .name = "yuv422p10le",
4a59eca9
TB
1251 .nb_components = 3,
1252 .log2_chroma_w = 1,
1253 .log2_chroma_h = 0,
5c511ad4 1254 .comp = {
2268db2c
VG
1255 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1256 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1257 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
5c511ad4 1258 },
e6c4ac7b 1259 .flags = AV_PIX_FMT_FLAG_PLANAR,
5c511ad4 1260 },
716d413c 1261 [AV_PIX_FMT_YUV422P10BE] = {
5c511ad4 1262 .name = "yuv422p10be",
4a59eca9
TB
1263 .nb_components = 3,
1264 .log2_chroma_w = 1,
1265 .log2_chroma_h = 0,
5c511ad4 1266 .comp = {
2268db2c
VG
1267 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1268 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1269 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
5c511ad4 1270 },
e6c4ac7b 1271 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
5c511ad4 1272 },
716d413c 1273 [AV_PIX_FMT_YUV422P16LE] = {
35f6c154 1274 .name = "yuv422p16le",
4a59eca9
TB
1275 .nb_components = 3,
1276 .log2_chroma_w = 1,
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_YUV422P16BE] = {
35f6c154 1286 .name = "yuv422p16be",
4a59eca9
TB
1287 .nb_components = 3,
1288 .log2_chroma_w = 1,
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_YUV444P16LE] = {
35f6c154 1298 .name = "yuv444p16le",
4a59eca9
TB
1299 .nb_components = 3,
1300 .log2_chroma_w = 0,
1301 .log2_chroma_h = 0,
75801da5 1302 .comp = {
2268db2c
VG
1303 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1304 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1305 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
75801da5 1306 },
e6c4ac7b 1307 .flags = AV_PIX_FMT_FLAG_PLANAR,
75801da5 1308 },
716d413c 1309 [AV_PIX_FMT_YUV444P16BE] = {
35f6c154 1310 .name = "yuv444p16be",
4a59eca9
TB
1311 .nb_components = 3,
1312 .log2_chroma_w = 0,
1313 .log2_chroma_h = 0,
75801da5 1314 .comp = {
2268db2c
VG
1315 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1316 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1317 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
75801da5 1318 },
e6c4ac7b 1319 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
75801da5 1320 },
716d413c 1321 [AV_PIX_FMT_YUV444P10LE] = {
103278f7 1322 .name = "yuv444p10le",
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, 10, 1, 9, 1 }, /* Y */
1328 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1329 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
103278f7 1330 },
e6c4ac7b 1331 .flags = AV_PIX_FMT_FLAG_PLANAR,
103278f7 1332 },
716d413c 1333 [AV_PIX_FMT_YUV444P10BE] = {
103278f7 1334 .name = "yuv444p10be",
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, 10, 1, 9, 1 }, /* Y */
1340 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1341 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
103278f7 1342 },
e6c4ac7b 1343 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
103278f7 1344 },
716d413c 1345 [AV_PIX_FMT_YUV444P9LE] = {
103278f7 1346 .name = "yuv444p9le",
4a59eca9
TB
1347 .nb_components = 3,
1348 .log2_chroma_w = 0,
1349 .log2_chroma_h = 0,
103278f7 1350 .comp = {
2268db2c
VG
1351 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1352 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1353 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
103278f7 1354 },
e6c4ac7b 1355 .flags = AV_PIX_FMT_FLAG_PLANAR,
103278f7 1356 },
716d413c 1357 [AV_PIX_FMT_YUV444P9BE] = {
103278f7 1358 .name = "yuv444p9be",
4a59eca9
TB
1359 .nb_components = 3,
1360 .log2_chroma_w = 0,
1361 .log2_chroma_h = 0,
103278f7 1362 .comp = {
2268db2c
VG
1363 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1364 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1365 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
103278f7 1366 },
e6c4ac7b 1367 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
103278f7 1368 },
d8039ef8
SL
1369 [AV_PIX_FMT_D3D11VA_VLD] = {
1370 .name = "d3d11va_vld",
1371 .log2_chroma_w = 1,
1372 .log2_chroma_h = 1,
1373 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1374 },
716d413c 1375 [AV_PIX_FMT_DXVA2_VLD] = {
92c6a099
LA
1376 .name = "dxva2_vld",
1377 .log2_chroma_w = 1,
1378 .log2_chroma_h = 1,
e6c4ac7b 1379 .flags = AV_PIX_FMT_FLAG_HWACCEL,
92c6a099 1380 },
e96c3b81
VG
1381 [AV_PIX_FMT_YA8] = {
1382 .name = "ya8",
4a59eca9 1383 .nb_components = 2,
4744f896 1384 .comp = {
2268db2c
VG
1385 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
1386 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
4744f896 1387 },
e6c4ac7b 1388 .flags = AV_PIX_FMT_FLAG_ALPHA,
e96c3b81 1389 .alias = "gray8a",
4744f896 1390 },
e9abafca
VG
1391 [AV_PIX_FMT_YA16LE] = {
1392 .name = "ya16le",
1393 .nb_components = 2,
1394 .comp = {
2268db2c
VG
1395 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1396 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
e9abafca
VG
1397 },
1398 .flags = AV_PIX_FMT_FLAG_ALPHA,
1399 },
1400 [AV_PIX_FMT_YA16BE] = {
1401 .name = "ya16be",
1402 .nb_components = 2,
1403 .comp = {
2268db2c
VG
1404 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1405 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
e9abafca
VG
1406 },
1407 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
1408 },
716d413c 1409 [AV_PIX_FMT_GBRP] = {
bd97b2e1 1410 .name = "gbrp",
4a59eca9
TB
1411 .nb_components = 3,
1412 .log2_chroma_w = 0,
1413 .log2_chroma_h = 0,
bd97b2e1 1414 .comp = {
e336c51e 1415 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
2268db2c
VG
1416 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1417 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
bd97b2e1 1418 },
e6c4ac7b 1419 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1420 },
716d413c 1421 [AV_PIX_FMT_GBRP9LE] = {
bd97b2e1 1422 .name = "gbrp9le",
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, 9, 1, 8, 1 }, /* R */
2268db2c
VG
1428 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1429 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
bd97b2e1 1430 },
e6c4ac7b 1431 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1432 },
716d413c 1433 [AV_PIX_FMT_GBRP9BE] = {
bd97b2e1 1434 .name = "gbrp9be",
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, 9, 1, 8, 1 }, /* R */
2268db2c
VG
1440 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1441 { 1, 2, 0, 0, 9, 1, 8, 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_GBRP10LE] = {
bd97b2e1 1446 .name = "gbrp10le",
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, 10, 1, 9, 1 }, /* R */
2268db2c
VG
1452 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1453 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
bd97b2e1 1454 },
e6c4ac7b 1455 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1456 },
716d413c 1457 [AV_PIX_FMT_GBRP10BE] = {
bd97b2e1 1458 .name = "gbrp10be",
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, 10, 1, 9, 1 }, /* R */
2268db2c
VG
1464 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1465 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
bd97b2e1 1466 },
e6c4ac7b 1467 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1468 },
716d413c 1469 [AV_PIX_FMT_GBRP16LE] = {
bd97b2e1 1470 .name = "gbrp16le",
4a59eca9
TB
1471 .nb_components = 3,
1472 .log2_chroma_w = 0,
1473 .log2_chroma_h = 0,
bd97b2e1 1474 .comp = {
e336c51e 1475 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
2268db2c
VG
1476 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1477 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
bd97b2e1 1478 },
e6c4ac7b 1479 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1480 },
716d413c 1481 [AV_PIX_FMT_GBRP16BE] = {
bd97b2e1 1482 .name = "gbrp16be",
4a59eca9
TB
1483 .nb_components = 3,
1484 .log2_chroma_w = 0,
1485 .log2_chroma_h = 0,
bd97b2e1 1486 .comp = {
e336c51e 1487 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
2268db2c
VG
1488 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1489 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
bd97b2e1 1490 },
e6c4ac7b 1491 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
bd97b2e1 1492 },
0e6c7dfa
PM
1493 [AV_PIX_FMT_GBRAP] = {
1494 .name = "gbrap",
1495 .nb_components = 4,
1496 .log2_chroma_w = 0,
1497 .log2_chroma_h = 0,
1498 .comp = {
e336c51e 1499 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
2268db2c
VG
1500 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1501 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
2268db2c 1502 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
0e6c7dfa 1503 },
592a0405
VG
1504 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1505 AV_PIX_FMT_FLAG_ALPHA,
0e6c7dfa
PM
1506 },
1507 [AV_PIX_FMT_GBRAP16LE] = {
1508 .name = "gbrap16le",
1509 .nb_components = 4,
1510 .log2_chroma_w = 0,
1511 .log2_chroma_h = 0,
1512 .comp = {
e336c51e 1513 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
2268db2c
VG
1514 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1515 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
2268db2c 1516 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
0e6c7dfa 1517 },
592a0405
VG
1518 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1519 AV_PIX_FMT_FLAG_ALPHA,
0e6c7dfa
PM
1520 },
1521 [AV_PIX_FMT_GBRAP16BE] = {
1522 .name = "gbrap16be",
1523 .nb_components = 4,
1524 .log2_chroma_w = 0,
1525 .log2_chroma_h = 0,
1526 .comp = {
e336c51e 1527 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
2268db2c
VG
1528 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1529 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
2268db2c 1530 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
0e6c7dfa 1531 },
592a0405
VG
1532 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1533 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
0e6c7dfa 1534 },
169fb94f
RDC
1535 [AV_PIX_FMT_VDPAU] = {
1536 .name = "vdpau",
1537 .log2_chroma_w = 1,
1538 .log2_chroma_h = 1,
e6c4ac7b 1539 .flags = AV_PIX_FMT_FLAG_HWACCEL,
169fb94f 1540 },
8c652645
NB
1541 [AV_PIX_FMT_XYZ12LE] = {
1542 .name = "xyz12le",
1543 .nb_components = 3,
1544 .log2_chroma_w = 0,
1545 .log2_chroma_h = 0,
1546 .comp = {
2268db2c
VG
1547 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1548 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1549 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
8c652645
NB
1550 },
1551 /*.flags = -- not used*/
1552 },
1553 [AV_PIX_FMT_XYZ12BE] = {
1554 .name = "xyz12be",
1555 .nb_components = 3,
1556 .log2_chroma_w = 0,
1557 .log2_chroma_h = 0,
1558 .comp = {
2268db2c
VG
1559 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1560 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1561 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
8c652645 1562 },
e6c4ac7b 1563 .flags = AV_PIX_FMT_FLAG_BE,
8c652645 1564 },
e208e6d2
KK
1565 [AV_PIX_FMT_NV16] = {
1566 .name = "nv16",
1567 .nb_components = 3,
1568 .log2_chroma_w = 1,
1569 .log2_chroma_h = 0,
1570 .comp = {
2268db2c
VG
1571 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
1572 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
1573 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
e208e6d2
KK
1574 },
1575 .flags = AV_PIX_FMT_FLAG_PLANAR,
1576 },
1577 [AV_PIX_FMT_NV20LE] = {
1578 .name = "nv20le",
1579 .nb_components = 3,
1580 .log2_chroma_w = 1,
1581 .log2_chroma_h = 0,
1582 .comp = {
2268db2c
VG
1583 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1584 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1585 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
e208e6d2
KK
1586 },
1587 .flags = AV_PIX_FMT_FLAG_PLANAR,
1588 },
1589 [AV_PIX_FMT_NV20BE] = {
1590 .name = "nv20be",
1591 .nb_components = 3,
1592 .log2_chroma_w = 1,
1593 .log2_chroma_h = 0,
1594 .comp = {
2268db2c
VG
1595 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1596 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1597 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
e208e6d2
KK
1598 },
1599 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
1600 },
66e6c8a7
AK
1601 [AV_PIX_FMT_VDA] = {
1602 .name = "vda",
1603 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1604 },
5b1d9cee
AK
1605 [AV_PIX_FMT_QSV] = {
1606 .name = "qsv",
1607 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1608 },
c4845616 1609 [AV_PIX_FMT_MMAL] = {
1610 .name = "mmal",
1611 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1612 },
7bc780cd
AK
1613 [AV_PIX_FMT_CUDA] = {
1614 .name = "cuda",
1615 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1616 },
b7c5f885
HL
1617 [AV_PIX_FMT_P010LE] = {
1618 .name = "p010le",
1619 .nb_components = 3,
1620 .log2_chroma_w = 1,
1621 .log2_chroma_h = 1,
1622 .comp = {
1623 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
1624 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
1625 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
1626 },
1627 .flags = AV_PIX_FMT_FLAG_PLANAR,
1628 },
1629 [AV_PIX_FMT_P010BE] = {
1630 .name = "p010be",
1631 .nb_components = 3,
1632 .log2_chroma_w = 1,
1633 .log2_chroma_h = 1,
1634 .comp = {
1635 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
1636 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
1637 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
1638 },
1639 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
1640 },
9b61d838 1641};
2268db2c
VG
1642#if FF_API_PLUS1_MINUS1
1643FF_ENABLE_DEPRECATION_WARNINGS
1644#endif
5efccce2 1645
bcc07e25
VG
1646static const char *color_range_names[] = {
1647 [AVCOL_RANGE_UNSPECIFIED] = "unknown",
1648 [AVCOL_RANGE_MPEG] = "tv",
1649 [AVCOL_RANGE_JPEG] = "pc",
5a419b2d
VG
1650};
1651
bcc07e25
VG
1652static const char *color_primaries_names[] = {
1653 [AVCOL_PRI_RESERVED0] = "reserved",
1654 [AVCOL_PRI_BT709] = "bt709",
1655 [AVCOL_PRI_UNSPECIFIED] = "unknown",
1656 [AVCOL_PRI_RESERVED] = "reserved",
1657 [AVCOL_PRI_BT470M] = "bt470m",
1658 [AVCOL_PRI_BT470BG] = "bt470bg",
1659 [AVCOL_PRI_SMPTE170M] = "smpte170m",
1660 [AVCOL_PRI_SMPTE240M] = "smpte240m",
1661 [AVCOL_PRI_FILM] = "film",
1662 [AVCOL_PRI_BT2020] = "bt2020",
f172e22d 1663 [AVCOL_PRI_SMPTE428] = "smpte428",
a8164323
VG
1664 [AVCOL_PRI_SMPTE431] = "smpte431",
1665 [AVCOL_PRI_SMPTE432] = "smpte432",
5a419b2d
VG
1666};
1667
bcc07e25
VG
1668static const char *color_transfer_names[] = {
1669 [AVCOL_TRC_RESERVED0] = "reserved",
1670 [AVCOL_TRC_BT709] = "bt709",
1671 [AVCOL_TRC_UNSPECIFIED] = "unknown",
1672 [AVCOL_TRC_RESERVED] = "reserved",
1673 [AVCOL_TRC_GAMMA22] = "bt470m",
1674 [AVCOL_TRC_GAMMA28] = "bt470bg",
1675 [AVCOL_TRC_SMPTE170M] = "smpte170m",
1676 [AVCOL_TRC_SMPTE240M] = "smpte240m",
1677 [AVCOL_TRC_LINEAR] = "linear",
1678 [AVCOL_TRC_LOG] = "log100",
1679 [AVCOL_TRC_LOG_SQRT] = "log316",
1680 [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
1681 [AVCOL_TRC_BT1361_ECG] = "bt1361e",
1682 [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
1683 [AVCOL_TRC_BT2020_10] = "bt2020-10",
444a3626 1684 [AVCOL_TRC_BT2020_12] = "bt2020-12",
f172e22d
VG
1685 [AVCOL_TRC_SMPTE2084] = "smpte2084",
1686 [AVCOL_TRC_SMPTE428] = "smpte428",
5d560d38 1687 [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
5a419b2d
VG
1688};
1689
bcc07e25
VG
1690static const char *color_space_names[] = {
1691 [AVCOL_SPC_RGB] = "gbr",
1692 [AVCOL_SPC_BT709] = "bt709",
1693 [AVCOL_SPC_UNSPECIFIED] = "unknown",
1694 [AVCOL_SPC_RESERVED] = "reserved",
1695 [AVCOL_SPC_FCC] = "fcc",
1696 [AVCOL_SPC_BT470BG] = "bt470bg",
1697 [AVCOL_SPC_SMPTE170M] = "smpte170m",
1698 [AVCOL_SPC_SMPTE240M] = "smpte240m",
1699 [AVCOL_SPC_YCOCG] = "ycgco",
1700 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
1701 [AVCOL_SPC_BT2020_CL] = "bt2020c",
a8164323 1702 [AVCOL_SPC_SMPTE2085] = "smpte2085",
5a419b2d
VG
1703};
1704
bcc07e25
VG
1705static const char *chroma_location_names[] = {
1706 [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
1707 [AVCHROMA_LOC_LEFT] = "left",
1708 [AVCHROMA_LOC_CENTER] = "center",
1709 [AVCHROMA_LOC_TOPLEFT] = "topleft",
1710 [AVCHROMA_LOC_TOP] = "top",
1711 [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
1712 [AVCHROMA_LOC_BOTTOM] = "bottom",
5a419b2d
VG
1713};
1714
716d413c 1715static enum AVPixelFormat get_pix_fmt_internal(const char *name)
80a07f6e 1716{
716d413c 1717 enum AVPixelFormat pix_fmt;
80a07f6e 1718
716d413c 1719 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
80a07f6e 1720 if (av_pix_fmt_descriptors[pix_fmt].name &&
d2962e9f
LB
1721 (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
1722 av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
80a07f6e
SS
1723 return pix_fmt;
1724
716d413c 1725 return AV_PIX_FMT_NONE;
80a07f6e
SS
1726}
1727
716d413c 1728const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
8f653e28 1729{
716d413c 1730 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
8f653e28
SS
1731 av_pix_fmt_descriptors[pix_fmt].name : NULL;
1732}
1733
80a07f6e
SS
1734#if HAVE_BIGENDIAN
1735# define X_NE(be, le) be
1736#else
1737# define X_NE(be, le) le
1738#endif
1739
716d413c 1740enum AVPixelFormat av_get_pix_fmt(const char *name)
80a07f6e 1741{
716d413c 1742 enum AVPixelFormat pix_fmt;
80a07f6e
SS
1743
1744 if (!strcmp(name, "rgb32"))
1745 name = X_NE("argb", "bgra");
1746 else if (!strcmp(name, "bgr32"))
1747 name = X_NE("abgr", "rgba");
1748
1749 pix_fmt = get_pix_fmt_internal(name);
716d413c 1750 if (pix_fmt == AV_PIX_FMT_NONE) {
80a07f6e
SS
1751 char name2[32];
1752
1753 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
1754 pix_fmt = get_pix_fmt_internal(name2);
1755 }
d264c720
MT
1756
1757#if FF_API_VAAPI
1758 if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
1759 pix_fmt = AV_PIX_FMT_VAAPI;
1760#endif
80a07f6e
SS
1761 return pix_fmt;
1762}
1763
5efccce2
SS
1764int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
1765{
1766 int c, bits = 0;
1767 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
1768
b8873c2a 1769 for (c = 0; c < pixdesc->nb_components; c++) {
4a59eca9 1770 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2268db2c 1771 bits += pixdesc->comp[c].depth << s;
5efccce2
SS
1772 }
1773
1774 return bits >> log2_pixels;
1775}
bb4afa13 1776
b2e059a1
LB
1777char *av_get_pix_fmt_string(char *buf, int buf_size,
1778 enum AVPixelFormat pix_fmt)
bb4afa13
SS
1779{
1780 /* print header */
1781 if (pix_fmt < 0) {
4a59eca9 1782 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
bb4afa13
SS
1783 } else {
1784 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
4a59eca9
TB
1785 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
1786 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
bb4afa13
SS
1787 }
1788
1789 return buf;
1790}
d2fcb356
AK
1791
1792const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1793{
1794 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1795 return NULL;
1796 return &av_pix_fmt_descriptors[pix_fmt];
1797}
1798
1799const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
1800{
1801 if (!prev)
1802 return &av_pix_fmt_descriptors[0];
1803 if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1)
1804 return prev + 1;
1805 return NULL;
1806}
1807
1808enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
1809{
1810 if (desc < av_pix_fmt_descriptors ||
1811 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
1812 return AV_PIX_FMT_NONE;
1813
1814 return desc - av_pix_fmt_descriptors;
1815}
c1a02e88
LB
1816
1817int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
1818 int *h_shift, int *v_shift)
1819{
1820 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
1821 if (!desc)
1822 return AVERROR(ENOSYS);
1823 *h_shift = desc->log2_chroma_w;
1824 *v_shift = desc->log2_chroma_h;
1825
1826 return 0;
1827}
2c328a90
AK
1828
1829int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
1830{
1831 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
1832 int i, planes[4] = { 0 }, ret = 0;
1833
1834 if (!desc)
1835 return AVERROR(EINVAL);
1836
1837 for (i = 0; i < desc->nb_components; i++)
1838 planes[desc->comp[i].plane] = 1;
1839 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
1840 ret += planes[i];
1841 return ret;
1842}
74652af8
JG
1843
1844
1845enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
1846{
1847#define PIX_FMT_SWAP_ENDIANNESS(fmt) \
1848 case AV_PIX_FMT_ ## fmt ## BE: return AV_PIX_FMT_ ## fmt ## LE; \
1849 case AV_PIX_FMT_ ## fmt ## LE: return AV_PIX_FMT_ ## fmt ## BE
1850
1851 switch (pix_fmt) {
1852 PIX_FMT_SWAP_ENDIANNESS(GRAY16);
e9abafca 1853 PIX_FMT_SWAP_ENDIANNESS(YA16);
74652af8
JG
1854 PIX_FMT_SWAP_ENDIANNESS(RGB48);
1855 PIX_FMT_SWAP_ENDIANNESS(RGB565);
1856 PIX_FMT_SWAP_ENDIANNESS(RGB555);
1857 PIX_FMT_SWAP_ENDIANNESS(RGB444);
1858 PIX_FMT_SWAP_ENDIANNESS(BGR48);
1859 PIX_FMT_SWAP_ENDIANNESS(BGR565);
1860 PIX_FMT_SWAP_ENDIANNESS(BGR555);
1861 PIX_FMT_SWAP_ENDIANNESS(BGR444);
1862
1863 PIX_FMT_SWAP_ENDIANNESS(YUV420P9);
1864 PIX_FMT_SWAP_ENDIANNESS(YUV422P9);
1865 PIX_FMT_SWAP_ENDIANNESS(YUV444P9);
1866 PIX_FMT_SWAP_ENDIANNESS(YUV420P10);
1867 PIX_FMT_SWAP_ENDIANNESS(YUV422P10);
1868 PIX_FMT_SWAP_ENDIANNESS(YUV444P10);
85406e7a 1869 PIX_FMT_SWAP_ENDIANNESS(YUV420P12);
74652af8
JG
1870 PIX_FMT_SWAP_ENDIANNESS(YUV420P16);
1871 PIX_FMT_SWAP_ENDIANNESS(YUV422P16);
1872 PIX_FMT_SWAP_ENDIANNESS(YUV444P16);
1873
1874 PIX_FMT_SWAP_ENDIANNESS(GBRP9);
1875 PIX_FMT_SWAP_ENDIANNESS(GBRP10);
1876 PIX_FMT_SWAP_ENDIANNESS(GBRP16);
1877 PIX_FMT_SWAP_ENDIANNESS(YUVA420P9);
1878 PIX_FMT_SWAP_ENDIANNESS(YUVA422P9);
1879 PIX_FMT_SWAP_ENDIANNESS(YUVA444P9);
1880 PIX_FMT_SWAP_ENDIANNESS(YUVA420P10);
1881 PIX_FMT_SWAP_ENDIANNESS(YUVA422P10);
1882 PIX_FMT_SWAP_ENDIANNESS(YUVA444P10);
1883 PIX_FMT_SWAP_ENDIANNESS(YUVA420P16);
1884 PIX_FMT_SWAP_ENDIANNESS(YUVA422P16);
1885 PIX_FMT_SWAP_ENDIANNESS(YUVA444P16);
1886
1887 PIX_FMT_SWAP_ENDIANNESS(XYZ12);
80035db8
JG
1888 PIX_FMT_SWAP_ENDIANNESS(NV20);
1889 PIX_FMT_SWAP_ENDIANNESS(RGBA64);
1890 PIX_FMT_SWAP_ENDIANNESS(BGRA64);
74652af8
JG
1891 default:
1892 return AV_PIX_FMT_NONE;
1893 }
1894#undef PIX_FMT_SWAP_ENDIANNESS
1895}
5a419b2d
VG
1896
1897const char *av_color_range_name(enum AVColorRange range)
1898{
1899 return (unsigned) range < AVCOL_RANGE_NB ?
1900 color_range_names[range] : NULL;
1901}
1902
1903const char *av_color_primaries_name(enum AVColorPrimaries primaries)
1904{
1905 return (unsigned) primaries < AVCOL_PRI_NB ?
1906 color_primaries_names[primaries] : NULL;
1907}
1908
1909const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
1910{
1911 return (unsigned) transfer < AVCOL_TRC_NB ?
1912 color_transfer_names[transfer] : NULL;
1913}
1914
1915const char *av_color_space_name(enum AVColorSpace space)
1916{
1917 return (unsigned) space < AVCOL_SPC_NB ?
1918 color_space_names[space] : NULL;
1919}
1920
1921const char *av_chroma_location_name(enum AVChromaLocation location)
1922{
1923 return (unsigned) location < AVCHROMA_LOC_NB ?
1924 chroma_location_names[location] : NULL;
1925}
1926