build: add support for Tru64 (OSF/1)
[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>
51135d1d 24#include "pixfmt.h"
9b61d838
MN
25#include "pixdesc.h"
26
f47a7cb7
SS
27#include "intreadwrite.h"
28
a6842670
LB
29void av_read_image_line(uint16_t *dst,
30 const uint8_t *data[4], const int linesize[4],
31 const AVPixFmtDescriptor *desc,
32 int x, int y, int c, int w,
4a59eca9 33 int read_pal_component)
f47a7cb7 34{
4a59eca9
TB
35 AVComponentDescriptor comp = desc->comp[c];
36 int plane = comp.plane;
37 int depth = comp.depth_minus1 + 1;
38 int mask = (1 << depth) - 1;
39 int shift = comp.shift;
40 int step = comp.step_minus1 + 1;
41 int flags = desc->flags;
f47a7cb7 42
4a59eca9
TB
43 if (flags & PIX_FMT_BITSTREAM) {
44 int skip = x * step + comp.offset_plus1 - 1;
45 const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
46 int shift = 8 - depth - (skip & 7);
f47a7cb7 47
4a59eca9 48 while (w--) {
f47a7cb7 49 int val = (*p >> shift) & mask;
4a59eca9
TB
50 if (read_pal_component)
51 val = data[1][4*val + c];
f47a7cb7 52 shift -= step;
4a59eca9 53 p -= shift >> 3;
f47a7cb7 54 shift &= 7;
4a59eca9 55 *dst++ = val;
f47a7cb7
SS
56 }
57 } else {
a6842670
LB
58 const uint8_t *p = data[plane] + y * linesize[plane] +
59 x * step + comp.offset_plus1 - 1;
4660143a 60 int is_8bit = shift + depth <= 8;
f47a7cb7 61
4660143a 62 if (is_8bit)
9525243f 63 p += !!(flags & PIX_FMT_BE);
4660143a 64
4a59eca9 65 while (w--) {
9525243f
MR
66 int val = is_8bit ? *p :
67 flags & PIX_FMT_BE ? AV_RB16(p) : AV_RL16(p);
4a59eca9
TB
68 val = (val >> shift) & mask;
69 if (read_pal_component)
70 val = data[1][4 * val + c];
71 p += step;
72 *dst++ = val;
f47a7cb7
SS
73 }
74 }
75}
76
a6842670
LB
77void av_write_image_line(const uint16_t *src,
78 uint8_t *data[4], const int linesize[4],
79 const AVPixFmtDescriptor *desc,
80 int x, int y, int c, int w)
f47a7cb7
SS
81{
82 AVComponentDescriptor comp = desc->comp[c];
83 int plane = comp.plane;
4a59eca9
TB
84 int depth = comp.depth_minus1 + 1;
85 int step = comp.step_minus1 + 1;
f47a7cb7
SS
86 int flags = desc->flags;
87
88 if (flags & PIX_FMT_BITSTREAM) {
4a59eca9
TB
89 int skip = x * step + comp.offset_plus1 - 1;
90 uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
91 int shift = 8 - depth - (skip & 7);
f47a7cb7
SS
92
93 while (w--) {
94 *p |= *src++ << shift;
95 shift -= step;
4a59eca9 96 p -= shift >> 3;
f47a7cb7
SS
97 shift &= 7;
98 }
99 } else {
100 int shift = comp.shift;
a6842670
LB
101 uint8_t *p = data[plane] + y * linesize[plane] +
102 x * step + comp.offset_plus1 - 1;
f47a7cb7 103
9525243f
MR
104 if (shift + depth <= 8) {
105 p += !!(flags & PIX_FMT_BE);
106 while (w--) {
4a59eca9 107 *p |= (*src++ << shift);
9525243f
MR
108 p += step;
109 }
110 } else {
78b19cf0
MR
111 while (w--) {
112 if (flags & PIX_FMT_BE) {
4a59eca9 113 uint16_t val = AV_RB16(p) | (*src++ << shift);
78b19cf0
MR
114 AV_WB16(p, val);
115 } else {
4a59eca9 116 uint16_t val = AV_RL16(p) | (*src++ << shift);
78b19cf0
MR
117 AV_WL16(p, val);
118 }
4a59eca9 119 p += step;
f47a7cb7 120 }
9525243f 121 }
f47a7cb7
SS
122 }
123}
124
716d413c
AK
125const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
126 [AV_PIX_FMT_YUV420P] = {
bcbd9a14 127 .name = "yuv420p",
4a59eca9
TB
128 .nb_components = 3,
129 .log2_chroma_w = 1,
130 .log2_chroma_h = 1,
9b61d838 131 .comp = {
4a59eca9
TB
132 { 0, 0, 1, 0, 7 }, /* Y */
133 { 1, 0, 1, 0, 7 }, /* U */
134 { 2, 0, 1, 0, 7 }, /* V */
9b61d838 135 },
6b0768e2 136 .flags = PIX_FMT_PLANAR,
9b61d838 137 },
716d413c 138 [AV_PIX_FMT_YUYV422] = {
bcbd9a14 139 .name = "yuyv422",
4a59eca9
TB
140 .nb_components = 3,
141 .log2_chroma_w = 1,
142 .log2_chroma_h = 0,
bcbd9a14 143 .comp = {
4a59eca9
TB
144 { 0, 1, 1, 0, 7 }, /* Y */
145 { 0, 3, 2, 0, 7 }, /* U */
146 { 0, 3, 4, 0, 7 }, /* V */
bcbd9a14
SS
147 },
148 },
716d413c 149 [AV_PIX_FMT_RGB24] = {
bcbd9a14 150 .name = "rgb24",
4a59eca9
TB
151 .nb_components = 3,
152 .log2_chroma_w = 0,
153 .log2_chroma_h = 0,
bcbd9a14 154 .comp = {
4a59eca9
TB
155 { 0, 2, 1, 0, 7 }, /* R */
156 { 0, 2, 2, 0, 7 }, /* G */
157 { 0, 2, 3, 0, 7 }, /* B */
bcbd9a14 158 },
6b0768e2 159 .flags = PIX_FMT_RGB,
bcbd9a14 160 },
716d413c 161 [AV_PIX_FMT_BGR24] = {
10151b13 162 .name = "bgr24",
4a59eca9
TB
163 .nb_components = 3,
164 .log2_chroma_w = 0,
165 .log2_chroma_h = 0,
10151b13 166 .comp = {
4a59eca9
TB
167 { 0, 2, 1, 0, 7 }, /* B */
168 { 0, 2, 2, 0, 7 }, /* G */
169 { 0, 2, 3, 0, 7 }, /* R */
10151b13 170 },
6b0768e2 171 .flags = PIX_FMT_RGB,
10151b13 172 },
716d413c 173 [AV_PIX_FMT_YUV422P] = {
bcbd9a14 174 .name = "yuv422p",
4a59eca9
TB
175 .nb_components = 3,
176 .log2_chroma_w = 1,
177 .log2_chroma_h = 0,
9b61d838 178 .comp = {
4a59eca9
TB
179 { 0, 0, 1, 0, 7 }, /* Y */
180 { 1, 0, 1, 0, 7 }, /* U */
181 { 2, 0, 1, 0, 7 }, /* V */
9b61d838 182 },
6b0768e2 183 .flags = PIX_FMT_PLANAR,
9b61d838 184 },
716d413c 185 [AV_PIX_FMT_YUV444P] = {
10151b13 186 .name = "yuv444p",
4a59eca9
TB
187 .nb_components = 3,
188 .log2_chroma_w = 0,
189 .log2_chroma_h = 0,
10151b13 190 .comp = {
4a59eca9
TB
191 { 0, 0, 1, 0, 7 }, /* Y */
192 { 1, 0, 1, 0, 7 }, /* U */
193 { 2, 0, 1, 0, 7 }, /* V */
10151b13 194 },
6b0768e2 195 .flags = PIX_FMT_PLANAR,
10151b13 196 },
716d413c 197 [AV_PIX_FMT_YUV410P] = {
1e896640 198 .name = "yuv410p",
4a59eca9
TB
199 .nb_components = 3,
200 .log2_chroma_w = 2,
201 .log2_chroma_h = 2,
9b61d838 202 .comp = {
4a59eca9
TB
203 { 0, 0, 1, 0, 7 }, /* Y */
204 { 1, 0, 1, 0, 7 }, /* U */
205 { 2, 0, 1, 0, 7 }, /* V */
9b61d838 206 },
6b0768e2 207 .flags = PIX_FMT_PLANAR,
9b61d838 208 },
716d413c 209 [AV_PIX_FMT_YUV411P] = {
10151b13 210 .name = "yuv411p",
4a59eca9
TB
211 .nb_components = 3,
212 .log2_chroma_w = 2,
213 .log2_chroma_h = 0,
10151b13 214 .comp = {
4a59eca9
TB
215 { 0, 0, 1, 0, 7 }, /* Y */
216 { 1, 0, 1, 0, 7 }, /* U */
217 { 2, 0, 1, 0, 7 }, /* V */
10151b13 218 },
6b0768e2 219 .flags = PIX_FMT_PLANAR,
10151b13 220 },
716d413c 221 [AV_PIX_FMT_GRAY8] = {
382cb115 222 .name = "gray",
4a59eca9
TB
223 .nb_components = 1,
224 .log2_chroma_w = 0,
225 .log2_chroma_h = 0,
10151b13 226 .comp = {
4a59eca9 227 { 0, 0, 1, 0, 7 }, /* Y */
10151b13
SS
228 },
229 },
716d413c 230 [AV_PIX_FMT_MONOWHITE] = {
382cb115 231 .name = "monow",
4a59eca9
TB
232 .nb_components = 1,
233 .log2_chroma_w = 0,
234 .log2_chroma_h = 0,
10151b13 235 .comp = {
4a59eca9 236 { 0, 0, 1, 0, 0 }, /* Y */
10151b13
SS
237 },
238 .flags = PIX_FMT_BITSTREAM,
239 },
716d413c 240 [AV_PIX_FMT_MONOBLACK] = {
382cb115 241 .name = "monob",
4a59eca9
TB
242 .nb_components = 1,
243 .log2_chroma_w = 0,
244 .log2_chroma_h = 0,
9b61d838 245 .comp = {
4a59eca9 246 { 0, 0, 1, 7, 0 }, /* Y */
9b61d838 247 },
bcbd9a14 248 .flags = PIX_FMT_BITSTREAM,
9b61d838 249 },
716d413c 250 [AV_PIX_FMT_PAL8] = {
bcbd9a14 251 .name = "pal8",
4a59eca9
TB
252 .nb_components = 1,
253 .log2_chroma_w = 0,
254 .log2_chroma_h = 0,
9b61d838 255 .comp = {
4a59eca9 256 { 0, 0, 1, 0, 7 },
9b61d838 257 },
bcbd9a14 258 .flags = PIX_FMT_PAL,
9b61d838 259 },
716d413c 260 [AV_PIX_FMT_YUVJ420P] = {
10151b13 261 .name = "yuvj420p",
4a59eca9
TB
262 .nb_components = 3,
263 .log2_chroma_w = 1,
264 .log2_chroma_h = 1,
10151b13 265 .comp = {
4a59eca9
TB
266 { 0, 0, 1, 0, 7 }, /* Y */
267 { 1, 0, 1, 0, 7 }, /* U */
268 { 2, 0, 1, 0, 7 }, /* V */
10151b13 269 },
6b0768e2 270 .flags = PIX_FMT_PLANAR,
10151b13 271 },
716d413c 272 [AV_PIX_FMT_YUVJ422P] = {
10151b13 273 .name = "yuvj422p",
4a59eca9
TB
274 .nb_components = 3,
275 .log2_chroma_w = 1,
276 .log2_chroma_h = 0,
10151b13 277 .comp = {
4a59eca9
TB
278 { 0, 0, 1, 0, 7 }, /* Y */
279 { 1, 0, 1, 0, 7 }, /* U */
280 { 2, 0, 1, 0, 7 }, /* V */
10151b13 281 },
6b0768e2 282 .flags = PIX_FMT_PLANAR,
10151b13 283 },
716d413c 284 [AV_PIX_FMT_YUVJ444P] = {
10151b13 285 .name = "yuvj444p",
4a59eca9
TB
286 .nb_components = 3,
287 .log2_chroma_w = 0,
288 .log2_chroma_h = 0,
10151b13 289 .comp = {
4a59eca9
TB
290 {0, 0, 1, 0, 7}, /* Y */
291 {1, 0, 1, 0, 7}, /* U */
292 {2, 0, 1, 0, 7}, /* V */
10151b13 293 },
6b0768e2 294 .flags = PIX_FMT_PLANAR,
10151b13 295 },
716d413c 296 [AV_PIX_FMT_XVMC_MPEG2_MC] = {
382cb115 297 .name = "xvmcmc",
3fa70a3b
SS
298 .flags = PIX_FMT_HWACCEL,
299 },
716d413c 300 [AV_PIX_FMT_XVMC_MPEG2_IDCT] = {
382cb115 301 .name = "xvmcidct",
3fa70a3b
SS
302 .flags = PIX_FMT_HWACCEL,
303 },
716d413c 304 [AV_PIX_FMT_UYVY422] = {
1e896640 305 .name = "uyvy422",
4a59eca9
TB
306 .nb_components = 3,
307 .log2_chroma_w = 1,
308 .log2_chroma_h = 0,
9b61d838 309 .comp = {
4a59eca9
TB
310 { 0, 1, 2, 0, 7 }, /* Y */
311 { 0, 3, 1, 0, 7 }, /* U */
312 { 0, 3, 3, 0, 7 }, /* V */
9b61d838
MN
313 },
314 },
716d413c 315 [AV_PIX_FMT_UYYVYY411] = {
10151b13 316 .name = "uyyvyy411",
4a59eca9
TB
317 .nb_components = 3,
318 .log2_chroma_w = 2,
319 .log2_chroma_h = 0,
10151b13 320 .comp = {
4a59eca9
TB
321 { 0, 3, 2, 0, 7 }, /* Y */
322 { 0, 5, 1, 0, 7 }, /* U */
323 { 0, 5, 4, 0, 7 }, /* V */
10151b13
SS
324 },
325 },
716d413c 326 [AV_PIX_FMT_BGR8] = {
10151b13 327 .name = "bgr8",
4a59eca9
TB
328 .nb_components = 3,
329 .log2_chroma_w = 0,
330 .log2_chroma_h = 0,
10151b13 331 .comp = {
4a59eca9
TB
332 { 0, 0, 1, 6, 1 }, /* B */
333 { 0, 0, 1, 3, 2 }, /* G */
334 { 0, 0, 1, 0, 2 }, /* R */
10151b13 335 },
38d55332 336 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
10151b13 337 },
716d413c 338 [AV_PIX_FMT_BGR4] = {
10151b13 339 .name = "bgr4",
4a59eca9
TB
340 .nb_components = 3,
341 .log2_chroma_w = 0,
342 .log2_chroma_h = 0,
10151b13 343 .comp = {
4a59eca9
TB
344 { 0, 3, 1, 0, 0 }, /* B */
345 { 0, 3, 2, 0, 1 }, /* G */
346 { 0, 3, 4, 0, 0 }, /* R */
10151b13 347 },
6b0768e2 348 .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
10151b13 349 },
716d413c 350 [AV_PIX_FMT_BGR4_BYTE] = {
10151b13 351 .name = "bgr4_byte",
4a59eca9
TB
352 .nb_components = 3,
353 .log2_chroma_w = 0,
354 .log2_chroma_h = 0,
10151b13 355 .comp = {
4a59eca9
TB
356 { 0, 0, 1, 3, 0 }, /* B */
357 { 0, 0, 1, 1, 1 }, /* G */
358 { 0, 0, 1, 0, 0 }, /* R */
10151b13 359 },
38d55332 360 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
10151b13 361 },
716d413c 362 [AV_PIX_FMT_RGB8] = {
10151b13 363 .name = "rgb8",
4a59eca9
TB
364 .nb_components = 3,
365 .log2_chroma_w = 0,
366 .log2_chroma_h = 0,
10151b13 367 .comp = {
4a59eca9
TB
368 { 0, 0, 1, 6, 1 }, /* R */
369 { 0, 0, 1, 3, 2 }, /* G */
370 { 0, 0, 1, 0, 2 }, /* B */
10151b13 371 },
38d55332 372 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
10151b13 373 },
716d413c 374 [AV_PIX_FMT_RGB4] = {
10151b13 375 .name = "rgb4",
4a59eca9
TB
376 .nb_components = 3,
377 .log2_chroma_w = 0,
378 .log2_chroma_h = 0,
10151b13 379 .comp = {
4a59eca9
TB
380 { 0, 3, 1, 0, 0 }, /* R */
381 { 0, 3, 2, 0, 1 }, /* G */
382 { 0, 3, 4, 0, 0 }, /* B */
10151b13 383 },
6b0768e2 384 .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
10151b13 385 },
716d413c 386 [AV_PIX_FMT_RGB4_BYTE] = {
10151b13 387 .name = "rgb4_byte",
4a59eca9
TB
388 .nb_components = 3,
389 .log2_chroma_w = 0,
390 .log2_chroma_h = 0,
10151b13 391 .comp = {
4a59eca9
TB
392 { 0, 0, 1, 3, 0 }, /* R */
393 { 0, 0, 1, 1, 1 }, /* G */
394 { 0, 0, 1, 0, 0 }, /* B */
10151b13 395 },
38d55332 396 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
10151b13 397 },
716d413c 398 [AV_PIX_FMT_NV12] = {
bcbd9a14 399 .name = "nv12",
4a59eca9
TB
400 .nb_components = 3,
401 .log2_chroma_w = 1,
402 .log2_chroma_h = 1,
9b61d838 403 .comp = {
a6842670
LB
404 { 0, 0, 1, 0, 7 }, /* Y */
405 { 1, 1, 1, 0, 7 }, /* U */
406 { 1, 1, 2, 0, 7 }, /* V */
9b61d838 407 },
6b0768e2 408 .flags = PIX_FMT_PLANAR,
9b61d838 409 },
716d413c 410 [AV_PIX_FMT_NV21] = {
10151b13 411 .name = "nv21",
4a59eca9
TB
412 .nb_components = 3,
413 .log2_chroma_w = 1,
414 .log2_chroma_h = 1,
10151b13 415 .comp = {
4a59eca9
TB
416 { 0, 0, 1, 0, 7 }, /* Y */
417 { 1, 1, 1, 0, 7 }, /* V */
418 { 1, 1, 2, 0, 7 }, /* U */
10151b13 419 },
6b0768e2 420 .flags = PIX_FMT_PLANAR,
10151b13 421 },
716d413c 422 [AV_PIX_FMT_ARGB] = {
10151b13 423 .name = "argb",
4a59eca9
TB
424 .nb_components = 4,
425 .log2_chroma_w = 0,
426 .log2_chroma_h = 0,
10151b13 427 .comp = {
4a59eca9
TB
428 { 0, 3, 1, 0, 7 }, /* A */
429 { 0, 3, 2, 0, 7 }, /* R */
430 { 0, 3, 3, 0, 7 }, /* G */
431 { 0, 3, 4, 0, 7 }, /* B */
10151b13 432 },
6b0768e2 433 .flags = PIX_FMT_RGB,
10151b13 434 },
716d413c 435 [AV_PIX_FMT_RGBA] = {
1e896640 436 .name = "rgba",
4a59eca9
TB
437 .nb_components = 4,
438 .log2_chroma_w = 0,
439 .log2_chroma_h = 0,
9b61d838 440 .comp = {
4a59eca9
TB
441 { 0, 3, 1, 0, 7 }, /* R */
442 { 0, 3, 2, 0, 7 }, /* G */
443 { 0, 3, 3, 0, 7 }, /* B */
444 { 0, 3, 4, 0, 7 }, /* A */
9b61d838 445 },
6b0768e2 446 .flags = PIX_FMT_RGB,
9b61d838 447 },
716d413c 448 [AV_PIX_FMT_ABGR] = {
10151b13 449 .name = "abgr",
4a59eca9
TB
450 .nb_components = 4,
451 .log2_chroma_w = 0,
452 .log2_chroma_h = 0,
10151b13 453 .comp = {
4a59eca9
TB
454 { 0, 3, 1, 0, 7 }, /* A */
455 { 0, 3, 2, 0, 7 }, /* B */
456 { 0, 3, 3, 0, 7 }, /* G */
457 { 0, 3, 4, 0, 7 }, /* R */
10151b13 458 },
6b0768e2 459 .flags = PIX_FMT_RGB,
10151b13 460 },
716d413c 461 [AV_PIX_FMT_BGRA] = {
10151b13 462 .name = "bgra",
4a59eca9
TB
463 .nb_components = 4,
464 .log2_chroma_w = 0,
465 .log2_chroma_h = 0,
10151b13 466 .comp = {
4a59eca9
TB
467 { 0, 3, 1, 0, 7 }, /* B */
468 { 0, 3, 2, 0, 7 }, /* G */
469 { 0, 3, 3, 0, 7 }, /* R */
470 { 0, 3, 4, 0, 7 }, /* A */
10151b13 471 },
6b0768e2 472 .flags = PIX_FMT_RGB,
10151b13 473 },
716d413c 474 [AV_PIX_FMT_GRAY16BE] = {
bcbd9a14 475 .name = "gray16be",
4a59eca9
TB
476 .nb_components = 1,
477 .log2_chroma_w = 0,
478 .log2_chroma_h = 0,
9b61d838 479 .comp = {
4a59eca9 480 { 0, 1, 1, 0, 15 }, /* Y */
bcbd9a14
SS
481 },
482 .flags = PIX_FMT_BE,
483 },
716d413c 484 [AV_PIX_FMT_GRAY16LE] = {
bcbd9a14 485 .name = "gray16le",
4a59eca9
TB
486 .nb_components = 1,
487 .log2_chroma_w = 0,
488 .log2_chroma_h = 0,
bcbd9a14 489 .comp = {
4a59eca9 490 { 0, 1, 1, 0, 15 }, /* Y */
9b61d838
MN
491 },
492 },
716d413c 493 [AV_PIX_FMT_YUV440P] = {
10151b13 494 .name = "yuv440p",
4a59eca9
TB
495 .nb_components = 3,
496 .log2_chroma_w = 0,
497 .log2_chroma_h = 1,
10151b13 498 .comp = {
4a59eca9
TB
499 { 0, 0, 1, 0, 7 }, /* Y */
500 { 1, 0, 1, 0, 7 }, /* U */
501 { 2, 0, 1, 0, 7 }, /* V */
10151b13 502 },
6b0768e2 503 .flags = PIX_FMT_PLANAR,
10151b13 504 },
716d413c 505 [AV_PIX_FMT_YUVJ440P] = {
10151b13 506 .name = "yuvj440p",
4a59eca9
TB
507 .nb_components = 3,
508 .log2_chroma_w = 0,
509 .log2_chroma_h = 1,
10151b13 510 .comp = {
4a59eca9
TB
511 { 0, 0, 1, 0, 7 }, /* Y */
512 { 1, 0, 1, 0, 7 }, /* U */
513 { 2, 0, 1, 0, 7 }, /* V */
10151b13 514 },
6b0768e2 515 .flags = PIX_FMT_PLANAR,
10151b13 516 },
716d413c 517 [AV_PIX_FMT_YUVA420P] = {
10151b13 518 .name = "yuva420p",
4a59eca9
TB
519 .nb_components = 4,
520 .log2_chroma_w = 1,
521 .log2_chroma_h = 1,
10151b13 522 .comp = {
4a59eca9
TB
523 { 0, 0, 1, 0, 7 }, /* Y */
524 { 1, 0, 1, 0, 7 }, /* U */
525 { 2, 0, 1, 0, 7 }, /* V */
526 { 3, 0, 1, 0, 7 }, /* A */
10151b13 527 },
6b0768e2 528 .flags = PIX_FMT_PLANAR,
10151b13 529 },
716d413c 530 [AV_PIX_FMT_VDPAU_H264] = {
3fa70a3b
SS
531 .name = "vdpau_h264",
532 .log2_chroma_w = 1,
533 .log2_chroma_h = 1,
534 .flags = PIX_FMT_HWACCEL,
535 },
716d413c 536 [AV_PIX_FMT_VDPAU_MPEG1] = {
3fa70a3b
SS
537 .name = "vdpau_mpeg1",
538 .log2_chroma_w = 1,
539 .log2_chroma_h = 1,
540 .flags = PIX_FMT_HWACCEL,
541 },
716d413c 542 [AV_PIX_FMT_VDPAU_MPEG2] = {
3fa70a3b
SS
543 .name = "vdpau_mpeg2",
544 .log2_chroma_w = 1,
545 .log2_chroma_h = 1,
546 .flags = PIX_FMT_HWACCEL,
547 },
716d413c 548 [AV_PIX_FMT_VDPAU_WMV3] = {
3fa70a3b
SS
549 .name = "vdpau_wmv3",
550 .log2_chroma_w = 1,
551 .log2_chroma_h = 1,
552 .flags = PIX_FMT_HWACCEL,
553 },
716d413c 554 [AV_PIX_FMT_VDPAU_VC1] = {
3fa70a3b
SS
555 .name = "vdpau_vc1",
556 .log2_chroma_w = 1,
557 .log2_chroma_h = 1,
558 .flags = PIX_FMT_HWACCEL,
559 },
716d413c 560 [AV_PIX_FMT_VDPAU_MPEG4] = {
dd6308ad
CEH
561 .name = "vdpau_mpeg4",
562 .log2_chroma_w = 1,
563 .log2_chroma_h = 1,
564 .flags = PIX_FMT_HWACCEL,
565 },
716d413c 566 [AV_PIX_FMT_RGB48BE] = {
1e896640 567 .name = "rgb48be",
4a59eca9
TB
568 .nb_components = 3,
569 .log2_chroma_w = 0,
570 .log2_chroma_h = 0,
9b61d838 571 .comp = {
4a59eca9
TB
572 { 0, 5, 1, 0, 15 }, /* R */
573 { 0, 5, 3, 0, 15 }, /* G */
574 { 0, 5, 5, 0, 15 }, /* B */
9b61d838 575 },
f7f18352 576 .flags = PIX_FMT_RGB | PIX_FMT_BE,
9b61d838 577 },
716d413c 578 [AV_PIX_FMT_RGB48LE] = {
bcbd9a14 579 .name = "rgb48le",
4a59eca9
TB
580 .nb_components = 3,
581 .log2_chroma_w = 0,
582 .log2_chroma_h = 0,
9b61d838 583 .comp = {
4a59eca9
TB
584 { 0, 5, 1, 0, 15 }, /* R */
585 { 0, 5, 3, 0, 15 }, /* G */
586 { 0, 5, 5, 0, 15 }, /* B */
9b61d838 587 },
6b0768e2 588 .flags = PIX_FMT_RGB,
9b61d838 589 },
716d413c 590 [AV_PIX_FMT_RGB565BE] = {
1e896640 591 .name = "rgb565be",
4a59eca9
TB
592 .nb_components = 3,
593 .log2_chroma_w = 0,
594 .log2_chroma_h = 0,
9b61d838 595 .comp = {
4a59eca9
TB
596 { 0, 1, 0, 3, 4 }, /* R */
597 { 0, 1, 1, 5, 5 }, /* G */
598 { 0, 1, 1, 0, 4 }, /* B */
9b61d838 599 },
6b0768e2 600 .flags = PIX_FMT_BE | PIX_FMT_RGB,
9b61d838 601 },
716d413c 602 [AV_PIX_FMT_RGB565LE] = {
bcbd9a14 603 .name = "rgb565le",
4a59eca9
TB
604 .nb_components = 3,
605 .log2_chroma_w = 0,
606 .log2_chroma_h = 0,
9b61d838 607 .comp = {
4a59eca9
TB
608 { 0, 1, 2, 3, 4 }, /* R */
609 { 0, 1, 1, 5, 5 }, /* G */
610 { 0, 1, 1, 0, 4 }, /* B */
9b61d838 611 },
6b0768e2 612 .flags = PIX_FMT_RGB,
9b61d838 613 },
716d413c 614 [AV_PIX_FMT_RGB555BE] = {
10151b13 615 .name = "rgb555be",
4a59eca9
TB
616 .nb_components = 3,
617 .log2_chroma_w = 0,
618 .log2_chroma_h = 0,
10151b13 619 .comp = {
4a59eca9
TB
620 { 0, 1, 0, 2, 4 }, /* R */
621 { 0, 1, 1, 5, 4 }, /* G */
622 { 0, 1, 1, 0, 4 }, /* B */
10151b13 623 },
6b0768e2 624 .flags = PIX_FMT_BE | PIX_FMT_RGB,
10151b13 625 },
716d413c 626 [AV_PIX_FMT_RGB555LE] = {
10151b13 627 .name = "rgb555le",
4a59eca9
TB
628 .nb_components = 3,
629 .log2_chroma_w = 0,
630 .log2_chroma_h = 0,
10151b13 631 .comp = {
4a59eca9
TB
632 { 0, 1, 2, 2, 4 }, /* R */
633 { 0, 1, 1, 5, 4 }, /* G */
634 { 0, 1, 1, 0, 4 }, /* B */
10151b13 635 },
6b0768e2 636 .flags = PIX_FMT_RGB,
10151b13 637 },
716d413c 638 [AV_PIX_FMT_RGB444BE] = {
2b7cf167 639 .name = "rgb444be",
4a59eca9
TB
640 .nb_components = 3,
641 .log2_chroma_w = 0,
642 .log2_chroma_h = 0,
2b7cf167 643 .comp = {
4a59eca9
TB
644 { 0, 1, 0, 0, 3 }, /* R */
645 { 0, 1, 1, 4, 3 }, /* G */
646 { 0, 1, 1, 0, 3 }, /* B */
2b7cf167 647 },
6b0768e2 648 .flags = PIX_FMT_BE | PIX_FMT_RGB,
2b7cf167 649 },
716d413c 650 [AV_PIX_FMT_RGB444LE] = {
2b7cf167 651 .name = "rgb444le",
4a59eca9
TB
652 .nb_components = 3,
653 .log2_chroma_w = 0,
654 .log2_chroma_h = 0,
2b7cf167 655 .comp = {
4a59eca9
TB
656 { 0, 1, 2, 0, 3 }, /* R */
657 { 0, 1, 1, 4, 3 }, /* G */
658 { 0, 1, 1, 0, 3 }, /* B */
2b7cf167 659 },
6b0768e2 660 .flags = PIX_FMT_RGB,
2b7cf167 661 },
716d413c 662 [AV_PIX_FMT_BGR48BE] = {
73389754 663 .name = "bgr48be",
4a59eca9
TB
664 .nb_components = 3,
665 .log2_chroma_w = 0,
666 .log2_chroma_h = 0,
73389754 667 .comp = {
4a59eca9
TB
668 { 0, 5, 1, 0, 15 }, /* B */
669 { 0, 5, 3, 0, 15 }, /* G */
670 { 0, 5, 5, 0, 15 }, /* R */
73389754 671 },
6b0768e2 672 .flags = PIX_FMT_BE | PIX_FMT_RGB,
73389754 673 },
716d413c 674 [AV_PIX_FMT_BGR48LE] = {
73389754 675 .name = "bgr48le",
4a59eca9
TB
676 .nb_components = 3,
677 .log2_chroma_w = 0,
678 .log2_chroma_h = 0,
73389754 679 .comp = {
4a59eca9
TB
680 { 0, 5, 1, 0, 15 }, /* B */
681 { 0, 5, 3, 0, 15 }, /* G */
682 { 0, 5, 5, 0, 15 }, /* R */
73389754 683 },
6b0768e2 684 .flags = PIX_FMT_RGB,
73389754 685 },
716d413c 686 [AV_PIX_FMT_BGR565BE] = {
10151b13 687 .name = "bgr565be",
4a59eca9
TB
688 .nb_components = 3,
689 .log2_chroma_w = 0,
690 .log2_chroma_h = 0,
10151b13 691 .comp = {
4a59eca9
TB
692 { 0, 1, 0, 3, 4 }, /* B */
693 { 0, 1, 1, 5, 5 }, /* G */
694 { 0, 1, 1, 0, 4 }, /* R */
10151b13 695 },
6b0768e2 696 .flags = PIX_FMT_BE | PIX_FMT_RGB,
10151b13 697 },
716d413c 698 [AV_PIX_FMT_BGR565LE] = {
10151b13 699 .name = "bgr565le",
4a59eca9
TB
700 .nb_components = 3,
701 .log2_chroma_w = 0,
702 .log2_chroma_h = 0,
10151b13 703 .comp = {
4a59eca9
TB
704 { 0, 1, 2, 3, 4 }, /* B */
705 { 0, 1, 1, 5, 5 }, /* G */
706 { 0, 1, 1, 0, 4 }, /* R */
10151b13 707 },
6b0768e2 708 .flags = PIX_FMT_RGB,
10151b13 709 },
716d413c 710 [AV_PIX_FMT_BGR555BE] = {
10151b13 711 .name = "bgr555be",
4a59eca9
TB
712 .nb_components = 3,
713 .log2_chroma_w = 0,
714 .log2_chroma_h = 0,
10151b13 715 .comp = {
4a59eca9
TB
716 { 0, 1, 0, 2, 4 }, /* B */
717 { 0, 1, 1, 5, 4 }, /* G */
718 { 0, 1, 1, 0, 4 }, /* R */
10151b13 719 },
6b0768e2 720 .flags = PIX_FMT_BE | PIX_FMT_RGB,
10151b13 721 },
716d413c 722 [AV_PIX_FMT_BGR555LE] = {
10151b13 723 .name = "bgr555le",
4a59eca9
TB
724 .nb_components = 3,
725 .log2_chroma_w = 0,
726 .log2_chroma_h = 0,
10151b13 727 .comp = {
4a59eca9
TB
728 { 0, 1, 2, 2, 4 }, /* B */
729 { 0, 1, 1, 5, 4 }, /* G */
730 { 0, 1, 1, 0, 4 }, /* R */
10151b13 731 },
6b0768e2 732 .flags = PIX_FMT_RGB,
10151b13 733 },
716d413c 734 [AV_PIX_FMT_BGR444BE] = {
2b7cf167 735 .name = "bgr444be",
4a59eca9
TB
736 .nb_components = 3,
737 .log2_chroma_w = 0,
738 .log2_chroma_h = 0,
2b7cf167 739 .comp = {
4a59eca9
TB
740 { 0, 1, 0, 0, 3 }, /* B */
741 { 0, 1, 1, 4, 3 }, /* G */
742 { 0, 1, 1, 0, 3 }, /* R */
2b7cf167 743 },
6b0768e2 744 .flags = PIX_FMT_BE | PIX_FMT_RGB,
2b7cf167 745 },
716d413c 746 [AV_PIX_FMT_BGR444LE] = {
2b7cf167 747 .name = "bgr444le",
4a59eca9
TB
748 .nb_components = 3,
749 .log2_chroma_w = 0,
750 .log2_chroma_h = 0,
2b7cf167 751 .comp = {
4a59eca9
TB
752 { 0, 1, 2, 0, 3 }, /* B */
753 { 0, 1, 1, 4, 3 }, /* G */
754 { 0, 1, 1, 0, 3 }, /* R */
2b7cf167 755 },
6b0768e2 756 .flags = PIX_FMT_RGB,
2b7cf167 757 },
716d413c 758 [AV_PIX_FMT_VAAPI_MOCO] = {
3fa70a3b
SS
759 .name = "vaapi_moco",
760 .log2_chroma_w = 1,
761 .log2_chroma_h = 1,
762 .flags = PIX_FMT_HWACCEL,
763 },
716d413c 764 [AV_PIX_FMT_VAAPI_IDCT] = {
3fa70a3b
SS
765 .name = "vaapi_idct",
766 .log2_chroma_w = 1,
767 .log2_chroma_h = 1,
768 .flags = PIX_FMT_HWACCEL,
769 },
716d413c 770 [AV_PIX_FMT_VAAPI_VLD] = {
3fa70a3b
SS
771 .name = "vaapi_vld",
772 .log2_chroma_w = 1,
773 .log2_chroma_h = 1,
774 .flags = PIX_FMT_HWACCEL,
775 },
716d413c 776 [AV_PIX_FMT_VDA_VLD] = {
ac3dbb4d
SZ
777 .name = "vda_vld",
778 .log2_chroma_w = 1,
779 .log2_chroma_h = 1,
780 .flags = PIX_FMT_HWACCEL,
781 },
716d413c 782 [AV_PIX_FMT_YUV420P9LE] = {
42239ced 783 .name = "yuv420p9le",
4a59eca9
TB
784 .nb_components = 3,
785 .log2_chroma_w = 1,
786 .log2_chroma_h = 1,
42239ced 787 .comp = {
4a59eca9
TB
788 { 0, 1, 1, 0, 8 }, /* Y */
789 { 1, 1, 1, 0, 8 }, /* U */
790 { 2, 1, 1, 0, 8 }, /* V */
42239ced 791 },
6b0768e2 792 .flags = PIX_FMT_PLANAR,
42239ced 793 },
716d413c 794 [AV_PIX_FMT_YUV420P9BE] = {
42239ced 795 .name = "yuv420p9be",
4a59eca9
TB
796 .nb_components = 3,
797 .log2_chroma_w = 1,
798 .log2_chroma_h = 1,
42239ced 799 .comp = {
4a59eca9
TB
800 { 0, 1, 1, 0, 8 }, /* Y */
801 { 1, 1, 1, 0, 8 }, /* U */
802 { 2, 1, 1, 0, 8 }, /* V */
42239ced 803 },
6b0768e2 804 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
42239ced 805 },
716d413c 806 [AV_PIX_FMT_YUV420P10LE] = {
42239ced 807 .name = "yuv420p10le",
4a59eca9
TB
808 .nb_components = 3,
809 .log2_chroma_w = 1,
810 .log2_chroma_h = 1,
42239ced 811 .comp = {
4a59eca9
TB
812 { 0, 1, 1, 0, 9 }, /* Y */
813 { 1, 1, 1, 0, 9 }, /* U */
814 { 2, 1, 1, 0, 9 }, /* V */
42239ced 815 },
6b0768e2 816 .flags = PIX_FMT_PLANAR,
42239ced 817 },
716d413c 818 [AV_PIX_FMT_YUV420P10BE] = {
42239ced 819 .name = "yuv420p10be",
4a59eca9
TB
820 .nb_components = 3,
821 .log2_chroma_w = 1,
822 .log2_chroma_h = 1,
42239ced 823 .comp = {
4a59eca9
TB
824 { 0, 1, 1, 0, 9 }, /* Y */
825 { 1, 1, 1, 0, 9 }, /* U */
826 { 2, 1, 1, 0, 9 }, /* V */
42239ced 827 },
6b0768e2 828 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
42239ced 829 },
716d413c 830 [AV_PIX_FMT_YUV420P16LE] = {
35f6c154 831 .name = "yuv420p16le",
4a59eca9
TB
832 .nb_components = 3,
833 .log2_chroma_w = 1,
834 .log2_chroma_h = 1,
75801da5 835 .comp = {
4a59eca9
TB
836 { 0, 1, 1, 0, 15 }, /* Y */
837 { 1, 1, 1, 0, 15 }, /* U */
838 { 2, 1, 1, 0, 15 }, /* V */
75801da5 839 },
6b0768e2 840 .flags = PIX_FMT_PLANAR,
75801da5 841 },
716d413c 842 [AV_PIX_FMT_YUV420P16BE] = {
35f6c154 843 .name = "yuv420p16be",
4a59eca9
TB
844 .nb_components = 3,
845 .log2_chroma_w = 1,
846 .log2_chroma_h = 1,
75801da5 847 .comp = {
4a59eca9
TB
848 { 0, 1, 1, 0, 15 }, /* Y */
849 { 1, 1, 1, 0, 15 }, /* U */
850 { 2, 1, 1, 0, 15 }, /* V */
75801da5 851 },
6b0768e2 852 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
75801da5 853 },
716d413c 854 [AV_PIX_FMT_YUV422P9LE] = {
dc49bf12 855 .name = "yuv422p9le",
4a59eca9
TB
856 .nb_components = 3,
857 .log2_chroma_w = 1,
858 .log2_chroma_h = 0,
dc49bf12 859 .comp = {
4a59eca9
TB
860 { 0, 1, 1, 0, 8 }, /* Y */
861 { 1, 1, 1, 0, 8 }, /* U */
862 { 2, 1, 1, 0, 8 }, /* V */
dc49bf12 863 },
6b0768e2 864 .flags = PIX_FMT_PLANAR,
dc49bf12 865 },
716d413c 866 [AV_PIX_FMT_YUV422P9BE] = {
dc49bf12 867 .name = "yuv422p9be",
4a59eca9
TB
868 .nb_components = 3,
869 .log2_chroma_w = 1,
870 .log2_chroma_h = 0,
dc49bf12 871 .comp = {
a6842670
LB
872 { 0, 1, 1, 0, 8 }, /* Y */
873 { 1, 1, 1, 0, 8 }, /* U */
874 { 2, 1, 1, 0, 8 }, /* V */
dc49bf12 875 },
6b0768e2 876 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
dc49bf12 877 },
716d413c 878 [AV_PIX_FMT_YUV422P10LE] = {
5c511ad4 879 .name = "yuv422p10le",
4a59eca9
TB
880 .nb_components = 3,
881 .log2_chroma_w = 1,
882 .log2_chroma_h = 0,
5c511ad4 883 .comp = {
4a59eca9
TB
884 { 0, 1, 1, 0, 9 }, /* Y */
885 { 1, 1, 1, 0, 9 }, /* U */
886 { 2, 1, 1, 0, 9 }, /* V */
5c511ad4 887 },
6b0768e2 888 .flags = PIX_FMT_PLANAR,
5c511ad4 889 },
716d413c 890 [AV_PIX_FMT_YUV422P10BE] = {
5c511ad4 891 .name = "yuv422p10be",
4a59eca9
TB
892 .nb_components = 3,
893 .log2_chroma_w = 1,
894 .log2_chroma_h = 0,
5c511ad4 895 .comp = {
4a59eca9
TB
896 { 0, 1, 1, 0, 9 }, /* Y */
897 { 1, 1, 1, 0, 9 }, /* U */
898 { 2, 1, 1, 0, 9 }, /* V */
5c511ad4 899 },
6b0768e2 900 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
5c511ad4 901 },
716d413c 902 [AV_PIX_FMT_YUV422P16LE] = {
35f6c154 903 .name = "yuv422p16le",
4a59eca9
TB
904 .nb_components = 3,
905 .log2_chroma_w = 1,
906 .log2_chroma_h = 0,
75801da5 907 .comp = {
4a59eca9
TB
908 { 0, 1, 1, 0, 15 }, /* Y */
909 { 1, 1, 1, 0, 15 }, /* U */
910 { 2, 1, 1, 0, 15 }, /* V */
75801da5 911 },
6b0768e2 912 .flags = PIX_FMT_PLANAR,
75801da5 913 },
716d413c 914 [AV_PIX_FMT_YUV422P16BE] = {
35f6c154 915 .name = "yuv422p16be",
4a59eca9
TB
916 .nb_components = 3,
917 .log2_chroma_w = 1,
918 .log2_chroma_h = 0,
75801da5 919 .comp = {
4a59eca9
TB
920 { 0, 1, 1, 0, 15 }, /* Y */
921 { 1, 1, 1, 0, 15 }, /* U */
922 { 2, 1, 1, 0, 15 }, /* V */
75801da5 923 },
6b0768e2 924 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
75801da5 925 },
716d413c 926 [AV_PIX_FMT_YUV444P16LE] = {
35f6c154 927 .name = "yuv444p16le",
4a59eca9
TB
928 .nb_components = 3,
929 .log2_chroma_w = 0,
930 .log2_chroma_h = 0,
75801da5 931 .comp = {
4a59eca9
TB
932 { 0, 1, 1, 0, 15 }, /* Y */
933 { 1, 1, 1, 0, 15 }, /* U */
934 { 2, 1, 1, 0, 15 }, /* V */
75801da5 935 },
6b0768e2 936 .flags = PIX_FMT_PLANAR,
75801da5 937 },
716d413c 938 [AV_PIX_FMT_YUV444P16BE] = {
35f6c154 939 .name = "yuv444p16be",
4a59eca9
TB
940 .nb_components = 3,
941 .log2_chroma_w = 0,
942 .log2_chroma_h = 0,
75801da5 943 .comp = {
4a59eca9
TB
944 { 0, 1, 1, 0, 15 }, /* Y */
945 { 1, 1, 1, 0, 15 }, /* U */
946 { 2, 1, 1, 0, 15 }, /* V */
75801da5 947 },
6b0768e2 948 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
75801da5 949 },
716d413c 950 [AV_PIX_FMT_YUV444P10LE] = {
103278f7 951 .name = "yuv444p10le",
4a59eca9
TB
952 .nb_components = 3,
953 .log2_chroma_w = 0,
954 .log2_chroma_h = 0,
103278f7 955 .comp = {
4a59eca9
TB
956 { 0, 1, 1, 0, 9 }, /* Y */
957 { 1, 1, 1, 0, 9 }, /* U */
958 { 2, 1, 1, 0, 9 }, /* V */
103278f7 959 },
6b0768e2 960 .flags = PIX_FMT_PLANAR,
103278f7 961 },
716d413c 962 [AV_PIX_FMT_YUV444P10BE] = {
103278f7 963 .name = "yuv444p10be",
4a59eca9
TB
964 .nb_components = 3,
965 .log2_chroma_w = 0,
966 .log2_chroma_h = 0,
103278f7 967 .comp = {
4a59eca9
TB
968 { 0, 1, 1, 0, 9 }, /* Y */
969 { 1, 1, 1, 0, 9 }, /* U */
970 { 2, 1, 1, 0, 9 }, /* V */
103278f7 971 },
6b0768e2 972 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
103278f7 973 },
716d413c 974 [AV_PIX_FMT_YUV444P9LE] = {
103278f7 975 .name = "yuv444p9le",
4a59eca9
TB
976 .nb_components = 3,
977 .log2_chroma_w = 0,
978 .log2_chroma_h = 0,
103278f7 979 .comp = {
4a59eca9
TB
980 { 0, 1, 1, 0, 8 }, /* Y */
981 { 1, 1, 1, 0, 8 }, /* U */
982 { 2, 1, 1, 0, 8 }, /* V */
103278f7 983 },
6b0768e2 984 .flags = PIX_FMT_PLANAR,
103278f7 985 },
716d413c 986 [AV_PIX_FMT_YUV444P9BE] = {
103278f7 987 .name = "yuv444p9be",
4a59eca9
TB
988 .nb_components = 3,
989 .log2_chroma_w = 0,
990 .log2_chroma_h = 0,
103278f7 991 .comp = {
4a59eca9
TB
992 { 0, 1, 1, 0, 8 }, /* Y */
993 { 1, 1, 1, 0, 8 }, /* U */
994 { 2, 1, 1, 0, 8 }, /* V */
103278f7 995 },
6b0768e2 996 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
103278f7 997 },
716d413c 998 [AV_PIX_FMT_DXVA2_VLD] = {
92c6a099
LA
999 .name = "dxva2_vld",
1000 .log2_chroma_w = 1,
1001 .log2_chroma_h = 1,
1002 .flags = PIX_FMT_HWACCEL,
1003 },
716d413c 1004 [AV_PIX_FMT_Y400A] = {
4744f896 1005 .name = "y400a",
4a59eca9 1006 .nb_components = 2,
4744f896 1007 .comp = {
4a59eca9
TB
1008 { 0, 1, 1, 0, 7 }, /* Y */
1009 { 0, 1, 2, 0, 7 }, /* A */
4744f896
1010 },
1011 },
716d413c 1012 [AV_PIX_FMT_GBRP] = {
bd97b2e1 1013 .name = "gbrp",
4a59eca9
TB
1014 .nb_components = 3,
1015 .log2_chroma_w = 0,
1016 .log2_chroma_h = 0,
bd97b2e1 1017 .comp = {
4a59eca9
TB
1018 { 0, 0, 1, 0, 7 }, /* G */
1019 { 1, 0, 1, 0, 7 }, /* B */
1020 { 2, 0, 1, 0, 7 }, /* R */
bd97b2e1 1021 },
6b0768e2 1022 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
bd97b2e1 1023 },
716d413c 1024 [AV_PIX_FMT_GBRP9LE] = {
bd97b2e1 1025 .name = "gbrp9le",
4a59eca9
TB
1026 .nb_components = 3,
1027 .log2_chroma_w = 0,
1028 .log2_chroma_h = 0,
bd97b2e1 1029 .comp = {
4a59eca9
TB
1030 { 0, 1, 1, 0, 8 }, /* G */
1031 { 1, 1, 1, 0, 8 }, /* B */
1032 { 2, 1, 1, 0, 8 }, /* R */
bd97b2e1 1033 },
6b0768e2 1034 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
bd97b2e1 1035 },
716d413c 1036 [AV_PIX_FMT_GBRP9BE] = {
bd97b2e1 1037 .name = "gbrp9be",
4a59eca9
TB
1038 .nb_components = 3,
1039 .log2_chroma_w = 0,
1040 .log2_chroma_h = 0,
bd97b2e1 1041 .comp = {
4a59eca9
TB
1042 { 0, 1, 1, 0, 8 }, /* G */
1043 { 1, 1, 1, 0, 8 }, /* B */
1044 { 2, 1, 1, 0, 8 }, /* R */
bd97b2e1 1045 },
6b0768e2 1046 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
bd97b2e1 1047 },
716d413c 1048 [AV_PIX_FMT_GBRP10LE] = {
bd97b2e1 1049 .name = "gbrp10le",
4a59eca9
TB
1050 .nb_components = 3,
1051 .log2_chroma_w = 0,
1052 .log2_chroma_h = 0,
bd97b2e1 1053 .comp = {
4a59eca9
TB
1054 { 0, 1, 1, 0, 9 }, /* G */
1055 { 1, 1, 1, 0, 9 }, /* B */
1056 { 2, 1, 1, 0, 9 }, /* R */
bd97b2e1 1057 },
6b0768e2 1058 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
bd97b2e1 1059 },
716d413c 1060 [AV_PIX_FMT_GBRP10BE] = {
bd97b2e1 1061 .name = "gbrp10be",
4a59eca9
TB
1062 .nb_components = 3,
1063 .log2_chroma_w = 0,
1064 .log2_chroma_h = 0,
bd97b2e1 1065 .comp = {
4a59eca9
TB
1066 { 0, 1, 1, 0, 9 }, /* G */
1067 { 1, 1, 1, 0, 9 }, /* B */
1068 { 2, 1, 1, 0, 9 }, /* R */
bd97b2e1 1069 },
6b0768e2 1070 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
bd97b2e1 1071 },
716d413c 1072 [AV_PIX_FMT_GBRP16LE] = {
bd97b2e1 1073 .name = "gbrp16le",
4a59eca9
TB
1074 .nb_components = 3,
1075 .log2_chroma_w = 0,
1076 .log2_chroma_h = 0,
bd97b2e1 1077 .comp = {
4a59eca9
TB
1078 { 0, 1, 1, 0, 15 }, /* G */
1079 { 1, 1, 1, 0, 15 }, /* B */
1080 { 2, 1, 1, 0, 15 }, /* R */
bd97b2e1 1081 },
6b0768e2 1082 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
bd97b2e1 1083 },
716d413c 1084 [AV_PIX_FMT_GBRP16BE] = {
bd97b2e1 1085 .name = "gbrp16be",
4a59eca9
TB
1086 .nb_components = 3,
1087 .log2_chroma_w = 0,
1088 .log2_chroma_h = 0,
bd97b2e1 1089 .comp = {
4a59eca9
TB
1090 { 0, 1, 1, 0, 15 }, /* G */
1091 { 1, 1, 1, 0, 15 }, /* B */
1092 { 2, 1, 1, 0, 15 }, /* R */
bd97b2e1 1093 },
6b0768e2 1094 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
bd97b2e1 1095 },
9b61d838 1096};
5efccce2 1097
716d413c 1098static enum AVPixelFormat get_pix_fmt_internal(const char *name)
80a07f6e 1099{
716d413c 1100 enum AVPixelFormat pix_fmt;
80a07f6e 1101
716d413c 1102 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
80a07f6e
SS
1103 if (av_pix_fmt_descriptors[pix_fmt].name &&
1104 !strcmp(av_pix_fmt_descriptors[pix_fmt].name, name))
1105 return pix_fmt;
1106
716d413c 1107 return AV_PIX_FMT_NONE;
80a07f6e
SS
1108}
1109
716d413c 1110const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
8f653e28 1111{
716d413c 1112 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
8f653e28
SS
1113 av_pix_fmt_descriptors[pix_fmt].name : NULL;
1114}
1115
80a07f6e
SS
1116#if HAVE_BIGENDIAN
1117# define X_NE(be, le) be
1118#else
1119# define X_NE(be, le) le
1120#endif
1121
716d413c 1122enum AVPixelFormat av_get_pix_fmt(const char *name)
80a07f6e 1123{
716d413c 1124 enum AVPixelFormat pix_fmt;
80a07f6e
SS
1125
1126 if (!strcmp(name, "rgb32"))
1127 name = X_NE("argb", "bgra");
1128 else if (!strcmp(name, "bgr32"))
1129 name = X_NE("abgr", "rgba");
1130
1131 pix_fmt = get_pix_fmt_internal(name);
716d413c 1132 if (pix_fmt == AV_PIX_FMT_NONE) {
80a07f6e
SS
1133 char name2[32];
1134
1135 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
1136 pix_fmt = get_pix_fmt_internal(name2);
1137 }
1138 return pix_fmt;
1139}
1140
5efccce2
SS
1141int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
1142{
1143 int c, bits = 0;
1144 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
1145
b8873c2a 1146 for (c = 0; c < pixdesc->nb_components; c++) {
4a59eca9
TB
1147 int s = c == 1 || c == 2 ? 0 : log2_pixels;
1148 bits += (pixdesc->comp[c].depth_minus1 + 1) << s;
5efccce2
SS
1149 }
1150
1151 return bits >> log2_pixels;
1152}
bb4afa13 1153
716d413c 1154char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt)
bb4afa13
SS
1155{
1156 /* print header */
1157 if (pix_fmt < 0) {
4a59eca9 1158 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
bb4afa13
SS
1159 } else {
1160 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
4a59eca9
TB
1161 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
1162 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
bb4afa13
SS
1163 }
1164
1165 return buf;
1166}