00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <stdio.h>
00023 #include <string.h>
00024 #include "pixfmt.h"
00025 #include "pixdesc.h"
00026
00027 #include "intreadwrite.h"
00028
00029 void av_read_image_line(uint16_t *dst,
00030 const uint8_t *data[4], const int linesize[4],
00031 const AVPixFmtDescriptor *desc,
00032 int x, int y, int c, int w,
00033 int read_pal_component)
00034 {
00035 AVComponentDescriptor comp = desc->comp[c];
00036 int plane = comp.plane;
00037 int depth = comp.depth_minus1 + 1;
00038 int mask = (1 << depth) - 1;
00039 int shift = comp.shift;
00040 int step = comp.step_minus1 + 1;
00041 int flags = desc->flags;
00042
00043 if (flags & PIX_FMT_BITSTREAM) {
00044 int skip = x * step + comp.offset_plus1 - 1;
00045 const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
00046 int shift = 8 - depth - (skip & 7);
00047
00048 while (w--) {
00049 int val = (*p >> shift) & mask;
00050 if (read_pal_component)
00051 val = data[1][4*val + c];
00052 shift -= step;
00053 p -= shift >> 3;
00054 shift &= 7;
00055 *dst++ = val;
00056 }
00057 } else {
00058 const uint8_t *p = data[plane] + y * linesize[plane] +
00059 x * step + comp.offset_plus1 - 1;
00060 int is_8bit = shift + depth <= 8;
00061
00062 if (is_8bit)
00063 p += !!(flags & PIX_FMT_BE);
00064
00065 while (w--) {
00066 int val = is_8bit ? *p :
00067 flags & PIX_FMT_BE ? AV_RB16(p) : AV_RL16(p);
00068 val = (val >> shift) & mask;
00069 if (read_pal_component)
00070 val = data[1][4 * val + c];
00071 p += step;
00072 *dst++ = val;
00073 }
00074 }
00075 }
00076
00077 void av_write_image_line(const uint16_t *src,
00078 uint8_t *data[4], const int linesize[4],
00079 const AVPixFmtDescriptor *desc,
00080 int x, int y, int c, int w)
00081 {
00082 AVComponentDescriptor comp = desc->comp[c];
00083 int plane = comp.plane;
00084 int depth = comp.depth_minus1 + 1;
00085 int step = comp.step_minus1 + 1;
00086 int flags = desc->flags;
00087
00088 if (flags & PIX_FMT_BITSTREAM) {
00089 int skip = x * step + comp.offset_plus1 - 1;
00090 uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
00091 int shift = 8 - depth - (skip & 7);
00092
00093 while (w--) {
00094 *p |= *src++ << shift;
00095 shift -= step;
00096 p -= shift >> 3;
00097 shift &= 7;
00098 }
00099 } else {
00100 int shift = comp.shift;
00101 uint8_t *p = data[plane] + y * linesize[plane] +
00102 x * step + comp.offset_plus1 - 1;
00103
00104 if (shift + depth <= 8) {
00105 p += !!(flags & PIX_FMT_BE);
00106 while (w--) {
00107 *p |= (*src++ << shift);
00108 p += step;
00109 }
00110 } else {
00111 while (w--) {
00112 if (flags & PIX_FMT_BE) {
00113 uint16_t val = AV_RB16(p) | (*src++ << shift);
00114 AV_WB16(p, val);
00115 } else {
00116 uint16_t val = AV_RL16(p) | (*src++ << shift);
00117 AV_WL16(p, val);
00118 }
00119 p += step;
00120 }
00121 }
00122 }
00123 }
00124
00125 const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
00126 [PIX_FMT_YUV420P] = {
00127 .name = "yuv420p",
00128 .nb_components = 3,
00129 .log2_chroma_w = 1,
00130 .log2_chroma_h = 1,
00131 .comp = {
00132 { 0, 0, 1, 0, 7 },
00133 { 1, 0, 1, 0, 7 },
00134 { 2, 0, 1, 0, 7 },
00135 },
00136 .flags = PIX_FMT_PLANAR,
00137 },
00138 [PIX_FMT_YUYV422] = {
00139 .name = "yuyv422",
00140 .nb_components = 3,
00141 .log2_chroma_w = 1,
00142 .log2_chroma_h = 0,
00143 .comp = {
00144 { 0, 1, 1, 0, 7 },
00145 { 0, 3, 2, 0, 7 },
00146 { 0, 3, 4, 0, 7 },
00147 },
00148 },
00149 [PIX_FMT_RGB24] = {
00150 .name = "rgb24",
00151 .nb_components = 3,
00152 .log2_chroma_w = 0,
00153 .log2_chroma_h = 0,
00154 .comp = {
00155 { 0, 2, 1, 0, 7 },
00156 { 0, 2, 2, 0, 7 },
00157 { 0, 2, 3, 0, 7 },
00158 },
00159 .flags = PIX_FMT_RGB,
00160 },
00161 [PIX_FMT_BGR24] = {
00162 .name = "bgr24",
00163 .nb_components = 3,
00164 .log2_chroma_w = 0,
00165 .log2_chroma_h = 0,
00166 .comp = {
00167 { 0, 2, 3, 0, 7 },
00168 { 0, 2, 2, 0, 7 },
00169 { 0, 2, 1, 0, 7 },
00170 },
00171 .flags = PIX_FMT_RGB,
00172 },
00173 [PIX_FMT_YUV422P] = {
00174 .name = "yuv422p",
00175 .nb_components = 3,
00176 .log2_chroma_w = 1,
00177 .log2_chroma_h = 0,
00178 .comp = {
00179 { 0, 0, 1, 0, 7 },
00180 { 1, 0, 1, 0, 7 },
00181 { 2, 0, 1, 0, 7 },
00182 },
00183 .flags = PIX_FMT_PLANAR,
00184 },
00185 [PIX_FMT_YUV444P] = {
00186 .name = "yuv444p",
00187 .nb_components = 3,
00188 .log2_chroma_w = 0,
00189 .log2_chroma_h = 0,
00190 .comp = {
00191 { 0, 0, 1, 0, 7 },
00192 { 1, 0, 1, 0, 7 },
00193 { 2, 0, 1, 0, 7 },
00194 },
00195 .flags = PIX_FMT_PLANAR,
00196 },
00197 [PIX_FMT_YUV410P] = {
00198 .name = "yuv410p",
00199 .nb_components = 3,
00200 .log2_chroma_w = 2,
00201 .log2_chroma_h = 2,
00202 .comp = {
00203 { 0, 0, 1, 0, 7 },
00204 { 1, 0, 1, 0, 7 },
00205 { 2, 0, 1, 0, 7 },
00206 },
00207 .flags = PIX_FMT_PLANAR,
00208 },
00209 [PIX_FMT_YUV411P] = {
00210 .name = "yuv411p",
00211 .nb_components = 3,
00212 .log2_chroma_w = 2,
00213 .log2_chroma_h = 0,
00214 .comp = {
00215 { 0, 0, 1, 0, 7 },
00216 { 1, 0, 1, 0, 7 },
00217 { 2, 0, 1, 0, 7 },
00218 },
00219 .flags = PIX_FMT_PLANAR,
00220 },
00221 [PIX_FMT_GRAY8] = {
00222 .name = "gray",
00223 .nb_components = 1,
00224 .log2_chroma_w = 0,
00225 .log2_chroma_h = 0,
00226 .comp = {
00227 { 0, 0, 1, 0, 7 },
00228 },
00229 .flags = PIX_FMT_PSEUDOPAL,
00230 },
00231 [PIX_FMT_MONOWHITE] = {
00232 .name = "monow",
00233 .nb_components = 1,
00234 .log2_chroma_w = 0,
00235 .log2_chroma_h = 0,
00236 .comp = {
00237 { 0, 0, 1, 0, 0 },
00238 },
00239 .flags = PIX_FMT_BITSTREAM,
00240 },
00241 [PIX_FMT_MONOBLACK] = {
00242 .name = "monob",
00243 .nb_components = 1,
00244 .log2_chroma_w = 0,
00245 .log2_chroma_h = 0,
00246 .comp = {
00247 { 0, 0, 1, 7, 0 },
00248 },
00249 .flags = PIX_FMT_BITSTREAM,
00250 },
00251 [PIX_FMT_PAL8] = {
00252 .name = "pal8",
00253 .nb_components = 1,
00254 .log2_chroma_w = 0,
00255 .log2_chroma_h = 0,
00256 .comp = {
00257 { 0, 0, 1, 0, 7 },
00258 },
00259 .flags = PIX_FMT_PAL,
00260 },
00261 [PIX_FMT_YUVJ420P] = {
00262 .name = "yuvj420p",
00263 .nb_components = 3,
00264 .log2_chroma_w = 1,
00265 .log2_chroma_h = 1,
00266 .comp = {
00267 { 0, 0, 1, 0, 7 },
00268 { 1, 0, 1, 0, 7 },
00269 { 2, 0, 1, 0, 7 },
00270 },
00271 .flags = PIX_FMT_PLANAR,
00272 },
00273 [PIX_FMT_YUVJ422P] = {
00274 .name = "yuvj422p",
00275 .nb_components = 3,
00276 .log2_chroma_w = 1,
00277 .log2_chroma_h = 0,
00278 .comp = {
00279 { 0, 0, 1, 0, 7 },
00280 { 1, 0, 1, 0, 7 },
00281 { 2, 0, 1, 0, 7 },
00282 },
00283 .flags = PIX_FMT_PLANAR,
00284 },
00285 [PIX_FMT_YUVJ444P] = {
00286 .name = "yuvj444p",
00287 .nb_components = 3,
00288 .log2_chroma_w = 0,
00289 .log2_chroma_h = 0,
00290 .comp = {
00291 { 0, 0, 1, 0, 7 },
00292 { 1, 0, 1, 0, 7 },
00293 { 2, 0, 1, 0, 7 },
00294 },
00295 .flags = PIX_FMT_PLANAR,
00296 },
00297 [PIX_FMT_XVMC_MPEG2_MC] = {
00298 .name = "xvmcmc",
00299 .flags = PIX_FMT_HWACCEL,
00300 },
00301 [PIX_FMT_XVMC_MPEG2_IDCT] = {
00302 .name = "xvmcidct",
00303 .flags = PIX_FMT_HWACCEL,
00304 },
00305 [PIX_FMT_UYVY422] = {
00306 .name = "uyvy422",
00307 .nb_components = 3,
00308 .log2_chroma_w = 1,
00309 .log2_chroma_h = 0,
00310 .comp = {
00311 { 0, 1, 2, 0, 7 },
00312 { 0, 3, 1, 0, 7 },
00313 { 0, 3, 3, 0, 7 },
00314 },
00315 },
00316 [PIX_FMT_UYYVYY411] = {
00317 .name = "uyyvyy411",
00318 .nb_components = 3,
00319 .log2_chroma_w = 2,
00320 .log2_chroma_h = 0,
00321 .comp = {
00322 { 0, 3, 2, 0, 7 },
00323 { 0, 5, 1, 0, 7 },
00324 { 0, 5, 4, 0, 7 },
00325 },
00326 },
00327 [PIX_FMT_BGR8] = {
00328 .name = "bgr8",
00329 .nb_components = 3,
00330 .log2_chroma_w = 0,
00331 .log2_chroma_h = 0,
00332 .comp = {
00333 { 0, 0, 1, 0, 2 },
00334 { 0, 0, 1, 3, 2 },
00335 { 0, 0, 1, 6, 1 },
00336 },
00337 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
00338 },
00339 [PIX_FMT_BGR4] = {
00340 .name = "bgr4",
00341 .nb_components = 3,
00342 .log2_chroma_w = 0,
00343 .log2_chroma_h = 0,
00344 .comp = {
00345 { 0, 3, 4, 0, 0 },
00346 { 0, 3, 2, 0, 1 },
00347 { 0, 3, 1, 0, 0 },
00348 },
00349 .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
00350 },
00351 [PIX_FMT_BGR4_BYTE] = {
00352 .name = "bgr4_byte",
00353 .nb_components = 3,
00354 .log2_chroma_w = 0,
00355 .log2_chroma_h = 0,
00356 .comp = {
00357 { 0, 0, 1, 0, 0 },
00358 { 0, 0, 1, 1, 1 },
00359 { 0, 0, 1, 3, 0 },
00360 },
00361 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
00362 },
00363 [PIX_FMT_RGB8] = {
00364 .name = "rgb8",
00365 .nb_components = 3,
00366 .log2_chroma_w = 0,
00367 .log2_chroma_h = 0,
00368 .comp = {
00369 { 0, 0, 1, 6, 1 },
00370 { 0, 0, 1, 3, 2 },
00371 { 0, 0, 1, 0, 2 },
00372 },
00373 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
00374 },
00375 [PIX_FMT_RGB4] = {
00376 .name = "rgb4",
00377 .nb_components = 3,
00378 .log2_chroma_w = 0,
00379 .log2_chroma_h = 0,
00380 .comp = {
00381 { 0, 3, 1, 0, 0 },
00382 { 0, 3, 2, 0, 1 },
00383 { 0, 3, 4, 0, 0 },
00384 },
00385 .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
00386 },
00387 [PIX_FMT_RGB4_BYTE] = {
00388 .name = "rgb4_byte",
00389 .nb_components = 3,
00390 .log2_chroma_w = 0,
00391 .log2_chroma_h = 0,
00392 .comp = {
00393 { 0, 0, 1, 3, 0 },
00394 { 0, 0, 1, 1, 1 },
00395 { 0, 0, 1, 0, 0 },
00396 },
00397 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
00398 },
00399 [PIX_FMT_NV12] = {
00400 .name = "nv12",
00401 .nb_components = 3,
00402 .log2_chroma_w = 1,
00403 .log2_chroma_h = 1,
00404 .comp = {
00405 { 0, 0, 1, 0, 7 },
00406 { 1, 1, 1, 0, 7 },
00407 { 1, 1, 2, 0, 7 },
00408 },
00409 .flags = PIX_FMT_PLANAR,
00410 },
00411 [PIX_FMT_NV21] = {
00412 .name = "nv21",
00413 .nb_components = 3,
00414 .log2_chroma_w = 1,
00415 .log2_chroma_h = 1,
00416 .comp = {
00417 { 0, 0, 1, 0, 7 },
00418 { 1, 1, 2, 0, 7 },
00419 { 1, 1, 1, 0, 7 },
00420 },
00421 .flags = PIX_FMT_PLANAR,
00422 },
00423 [PIX_FMT_ARGB] = {
00424 .name = "argb",
00425 .nb_components = 4,
00426 .log2_chroma_w = 0,
00427 .log2_chroma_h = 0,
00428 .comp = {
00429 { 0, 3, 2, 0, 7 },
00430 { 0, 3, 3, 0, 7 },
00431 { 0, 3, 4, 0, 7 },
00432 { 0, 3, 1, 0, 7 },
00433 },
00434 .flags = PIX_FMT_RGB,
00435 },
00436 [PIX_FMT_RGBA] = {
00437 .name = "rgba",
00438 .nb_components = 4,
00439 .log2_chroma_w = 0,
00440 .log2_chroma_h = 0,
00441 .comp = {
00442 { 0, 3, 1, 0, 7 },
00443 { 0, 3, 2, 0, 7 },
00444 { 0, 3, 3, 0, 7 },
00445 { 0, 3, 4, 0, 7 },
00446 },
00447 .flags = PIX_FMT_RGB,
00448 },
00449 [PIX_FMT_ABGR] = {
00450 .name = "abgr",
00451 .nb_components = 4,
00452 .log2_chroma_w = 0,
00453 .log2_chroma_h = 0,
00454 .comp = {
00455 { 0, 3, 4, 0, 7 },
00456 { 0, 3, 3, 0, 7 },
00457 { 0, 3, 2, 0, 7 },
00458 { 0, 3, 1, 0, 7 },
00459 },
00460 .flags = PIX_FMT_RGB,
00461 },
00462 [PIX_FMT_BGRA] = {
00463 .name = "bgra",
00464 .nb_components = 4,
00465 .log2_chroma_w = 0,
00466 .log2_chroma_h = 0,
00467 .comp = {
00468 { 0, 3, 3, 0, 7 },
00469 { 0, 3, 2, 0, 7 },
00470 { 0, 3, 1, 0, 7 },
00471 { 0, 3, 4, 0, 7 },
00472 },
00473 .flags = PIX_FMT_RGB,
00474 },
00475 [PIX_FMT_0RGB] = {
00476 .name = "0rgb",
00477 .nb_components= 3,
00478 .log2_chroma_w= 0,
00479 .log2_chroma_h= 0,
00480 .comp = {
00481 { 0, 3, 2, 0, 7 },
00482 { 0, 3, 3, 0, 7 },
00483 { 0, 3, 4, 0, 7 },
00484 },
00485 .flags = PIX_FMT_RGB,
00486 },
00487 [PIX_FMT_RGB0] = {
00488 .name = "rgb0",
00489 .nb_components= 3,
00490 .log2_chroma_w= 0,
00491 .log2_chroma_h= 0,
00492 .comp = {
00493 { 0, 3, 1, 0, 7 },
00494 { 0, 3, 2, 0, 7 },
00495 { 0, 3, 3, 0, 7 },
00496 { 0, 3, 4, 0, 7 },
00497 },
00498 .flags = PIX_FMT_RGB,
00499 },
00500 [PIX_FMT_0BGR] = {
00501 .name = "0bgr",
00502 .nb_components= 3,
00503 .log2_chroma_w= 0,
00504 .log2_chroma_h= 0,
00505 .comp = {
00506 { 0, 3, 4, 0, 7 },
00507 { 0, 3, 3, 0, 7 },
00508 { 0, 3, 2, 0, 7 },
00509 },
00510 .flags = PIX_FMT_RGB,
00511 },
00512 [PIX_FMT_BGR0] = {
00513 .name = "bgr0",
00514 .nb_components= 3,
00515 .log2_chroma_w= 0,
00516 .log2_chroma_h= 0,
00517 .comp = {
00518 { 0, 3, 3, 0, 7 },
00519 { 0, 3, 2, 0, 7 },
00520 { 0, 3, 1, 0, 7 },
00521 { 0, 3, 4, 0, 7 },
00522 },
00523 .flags = PIX_FMT_RGB,
00524 },
00525 [PIX_FMT_GRAY16BE] = {
00526 .name = "gray16be",
00527 .nb_components = 1,
00528 .log2_chroma_w = 0,
00529 .log2_chroma_h = 0,
00530 .comp = {
00531 { 0, 1, 1, 0, 15 },
00532 },
00533 .flags = PIX_FMT_BE,
00534 },
00535 [PIX_FMT_GRAY16LE] = {
00536 .name = "gray16le",
00537 .nb_components = 1,
00538 .log2_chroma_w = 0,
00539 .log2_chroma_h = 0,
00540 .comp = {
00541 { 0, 1, 1, 0, 15 },
00542 },
00543 },
00544 [PIX_FMT_YUV440P] = {
00545 .name = "yuv440p",
00546 .nb_components = 3,
00547 .log2_chroma_w = 0,
00548 .log2_chroma_h = 1,
00549 .comp = {
00550 { 0, 0, 1, 0, 7 },
00551 { 1, 0, 1, 0, 7 },
00552 { 2, 0, 1, 0, 7 },
00553 },
00554 .flags = PIX_FMT_PLANAR,
00555 },
00556 [PIX_FMT_YUVJ440P] = {
00557 .name = "yuvj440p",
00558 .nb_components = 3,
00559 .log2_chroma_w = 0,
00560 .log2_chroma_h = 1,
00561 .comp = {
00562 { 0, 0, 1, 0, 7 },
00563 { 1, 0, 1, 0, 7 },
00564 { 2, 0, 1, 0, 7 },
00565 },
00566 .flags = PIX_FMT_PLANAR,
00567 },
00568 [PIX_FMT_YUVA420P] = {
00569 .name = "yuva420p",
00570 .nb_components = 4,
00571 .log2_chroma_w = 1,
00572 .log2_chroma_h = 1,
00573 .comp = {
00574 { 0, 0, 1, 0, 7 },
00575 { 1, 0, 1, 0, 7 },
00576 { 2, 0, 1, 0, 7 },
00577 { 3, 0, 1, 0, 7 },
00578 },
00579 .flags = PIX_FMT_PLANAR,
00580 },
00581 [PIX_FMT_YUVA422P] = {
00582 .name = "yuva422p",
00583 .nb_components = 4,
00584 .log2_chroma_w = 1,
00585 .log2_chroma_h = 0,
00586 .comp = {
00587 { 0, 0, 1, 0, 7 },
00588 { 1, 0, 1, 0, 7 },
00589 { 2, 0, 1, 0, 7 },
00590 { 3, 0, 1, 0, 7 },
00591 },
00592 .flags = PIX_FMT_PLANAR,
00593 },
00594 [PIX_FMT_YUVA444P] = {
00595 .name = "yuva444p",
00596 .nb_components = 4,
00597 .log2_chroma_w = 0,
00598 .log2_chroma_h = 0,
00599 .comp = {
00600 { 0, 0, 1, 0, 7 },
00601 { 1, 0, 1, 0, 7 },
00602 { 2, 0, 1, 0, 7 },
00603 { 3, 0, 1, 0, 7 },
00604 },
00605 .flags = PIX_FMT_PLANAR,
00606 },
00607 [PIX_FMT_VDPAU_H264] = {
00608 .name = "vdpau_h264",
00609 .log2_chroma_w = 1,
00610 .log2_chroma_h = 1,
00611 .flags = PIX_FMT_HWACCEL,
00612 },
00613 [PIX_FMT_VDPAU_MPEG1] = {
00614 .name = "vdpau_mpeg1",
00615 .log2_chroma_w = 1,
00616 .log2_chroma_h = 1,
00617 .flags = PIX_FMT_HWACCEL,
00618 },
00619 [PIX_FMT_VDPAU_MPEG2] = {
00620 .name = "vdpau_mpeg2",
00621 .log2_chroma_w = 1,
00622 .log2_chroma_h = 1,
00623 .flags = PIX_FMT_HWACCEL,
00624 },
00625 [PIX_FMT_VDPAU_WMV3] = {
00626 .name = "vdpau_wmv3",
00627 .log2_chroma_w = 1,
00628 .log2_chroma_h = 1,
00629 .flags = PIX_FMT_HWACCEL,
00630 },
00631 [PIX_FMT_VDPAU_VC1] = {
00632 .name = "vdpau_vc1",
00633 .log2_chroma_w = 1,
00634 .log2_chroma_h = 1,
00635 .flags = PIX_FMT_HWACCEL,
00636 },
00637 [PIX_FMT_VDPAU_MPEG4] = {
00638 .name = "vdpau_mpeg4",
00639 .log2_chroma_w = 1,
00640 .log2_chroma_h = 1,
00641 .flags = PIX_FMT_HWACCEL,
00642 },
00643 [PIX_FMT_RGB48BE] = {
00644 .name = "rgb48be",
00645 .nb_components = 3,
00646 .log2_chroma_w = 0,
00647 .log2_chroma_h = 0,
00648 .comp = {
00649 { 0, 5, 1, 0, 15 },
00650 { 0, 5, 3, 0, 15 },
00651 { 0, 5, 5, 0, 15 },
00652 },
00653 .flags = PIX_FMT_RGB | PIX_FMT_BE,
00654 },
00655 [PIX_FMT_RGB48LE] = {
00656 .name = "rgb48le",
00657 .nb_components = 3,
00658 .log2_chroma_w = 0,
00659 .log2_chroma_h = 0,
00660 .comp = {
00661 { 0, 5, 1, 0, 15 },
00662 { 0, 5, 3, 0, 15 },
00663 { 0, 5, 5, 0, 15 },
00664 },
00665 .flags = PIX_FMT_RGB,
00666 },
00667 [PIX_FMT_RGBA64BE] = {
00668 .name = "rgba64be",
00669 .nb_components= 4,
00670 .log2_chroma_w= 0,
00671 .log2_chroma_h= 0,
00672 .comp = {
00673 { 0, 7, 1, 0, 15 },
00674 { 0, 7, 3, 0, 15 },
00675 { 0, 7, 5, 0, 15 },
00676 { 0, 7, 7, 0, 15 },
00677 },
00678 .flags = PIX_FMT_RGB | PIX_FMT_BE,
00679 },
00680 [PIX_FMT_RGBA64LE] = {
00681 .name = "rgba64le",
00682 .nb_components= 4,
00683 .log2_chroma_w= 0,
00684 .log2_chroma_h= 0,
00685 .comp = {
00686 { 0, 7, 1, 0, 15 },
00687 { 0, 7, 3, 0, 15 },
00688 { 0, 7, 5, 0, 15 },
00689 { 0, 7, 7, 0, 15 },
00690 },
00691 .flags = PIX_FMT_RGB,
00692 },
00693 [PIX_FMT_RGB565BE] = {
00694 .name = "rgb565be",
00695 .nb_components = 3,
00696 .log2_chroma_w = 0,
00697 .log2_chroma_h = 0,
00698 .comp = {
00699 { 0, 1, 0, 3, 4 },
00700 { 0, 1, 1, 5, 5 },
00701 { 0, 1, 1, 0, 4 },
00702 },
00703 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00704 },
00705 [PIX_FMT_RGB565LE] = {
00706 .name = "rgb565le",
00707 .nb_components = 3,
00708 .log2_chroma_w = 0,
00709 .log2_chroma_h = 0,
00710 .comp = {
00711 { 0, 1, 2, 3, 4 },
00712 { 0, 1, 1, 5, 5 },
00713 { 0, 1, 1, 0, 4 },
00714 },
00715 .flags = PIX_FMT_RGB,
00716 },
00717 [PIX_FMT_RGB555BE] = {
00718 .name = "rgb555be",
00719 .nb_components = 3,
00720 .log2_chroma_w = 0,
00721 .log2_chroma_h = 0,
00722 .comp = {
00723 { 0, 1, 0, 2, 4 },
00724 { 0, 1, 1, 5, 4 },
00725 { 0, 1, 1, 0, 4 },
00726 },
00727 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00728 },
00729 [PIX_FMT_RGB555LE] = {
00730 .name = "rgb555le",
00731 .nb_components = 3,
00732 .log2_chroma_w = 0,
00733 .log2_chroma_h = 0,
00734 .comp = {
00735 { 0, 1, 2, 2, 4 },
00736 { 0, 1, 1, 5, 4 },
00737 { 0, 1, 1, 0, 4 },
00738 },
00739 .flags = PIX_FMT_RGB,
00740 },
00741 [PIX_FMT_RGB444BE] = {
00742 .name = "rgb444be",
00743 .nb_components = 3,
00744 .log2_chroma_w = 0,
00745 .log2_chroma_h = 0,
00746 .comp = {
00747 { 0, 1, 0, 0, 3 },
00748 { 0, 1, 1, 4, 3 },
00749 { 0, 1, 1, 0, 3 },
00750 },
00751 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00752 },
00753 [PIX_FMT_RGB444LE] = {
00754 .name = "rgb444le",
00755 .nb_components = 3,
00756 .log2_chroma_w = 0,
00757 .log2_chroma_h = 0,
00758 .comp = {
00759 { 0, 1, 2, 0, 3 },
00760 { 0, 1, 1, 4, 3 },
00761 { 0, 1, 1, 0, 3 },
00762 },
00763 .flags = PIX_FMT_RGB,
00764 },
00765 [PIX_FMT_BGR48BE] = {
00766 .name = "bgr48be",
00767 .nb_components = 3,
00768 .log2_chroma_w = 0,
00769 .log2_chroma_h = 0,
00770 .comp = {
00771 { 0, 5, 5, 0, 15 },
00772 { 0, 5, 3, 0, 15 },
00773 { 0, 5, 1, 0, 15 },
00774 },
00775 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00776 },
00777 [PIX_FMT_BGR48LE] = {
00778 .name = "bgr48le",
00779 .nb_components = 3,
00780 .log2_chroma_w = 0,
00781 .log2_chroma_h = 0,
00782 .comp = {
00783 { 0, 5, 5, 0, 15 },
00784 { 0, 5, 3, 0, 15 },
00785 { 0, 5, 1, 0, 15 },
00786 },
00787 .flags = PIX_FMT_RGB,
00788 },
00789 [PIX_FMT_BGRA64BE] = {
00790 .name = "bgra64be",
00791 .nb_components= 4,
00792 .log2_chroma_w= 0,
00793 .log2_chroma_h= 0,
00794 .comp = {
00795 { 0, 7, 5, 0, 15 },
00796 { 0, 7, 3, 0, 15 },
00797 { 0, 7, 1, 0, 15 },
00798 { 0, 7, 7, 0, 15 },
00799 },
00800 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00801 },
00802 [PIX_FMT_BGRA64LE] = {
00803 .name = "bgra64le",
00804 .nb_components= 4,
00805 .log2_chroma_w= 0,
00806 .log2_chroma_h= 0,
00807 .comp = {
00808 { 0, 7, 5, 0, 15 },
00809 { 0, 7, 3, 0, 15 },
00810 { 0, 7, 1, 0, 15 },
00811 { 0, 7, 7, 0, 15 },
00812 },
00813 .flags = PIX_FMT_RGB,
00814 },
00815 [PIX_FMT_BGR565BE] = {
00816 .name = "bgr565be",
00817 .nb_components = 3,
00818 .log2_chroma_w = 0,
00819 .log2_chroma_h = 0,
00820 .comp = {
00821 { 0, 1, 1, 0, 4 },
00822 { 0, 1, 1, 5, 5 },
00823 { 0, 1, 0, 3, 4 },
00824 },
00825 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00826 },
00827 [PIX_FMT_BGR565LE] = {
00828 .name = "bgr565le",
00829 .nb_components = 3,
00830 .log2_chroma_w = 0,
00831 .log2_chroma_h = 0,
00832 .comp = {
00833 { 0, 1, 1, 0, 4 },
00834 { 0, 1, 1, 5, 5 },
00835 { 0, 1, 2, 3, 4 },
00836 },
00837 .flags = PIX_FMT_RGB,
00838 },
00839 [PIX_FMT_BGR555BE] = {
00840 .name = "bgr555be",
00841 .nb_components = 3,
00842 .log2_chroma_w = 0,
00843 .log2_chroma_h = 0,
00844 .comp = {
00845 { 0, 1, 1, 0, 4 },
00846 { 0, 1, 1, 5, 4 },
00847 { 0, 1, 0, 2, 4 },
00848 },
00849 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00850 },
00851 [PIX_FMT_BGR555LE] = {
00852 .name = "bgr555le",
00853 .nb_components = 3,
00854 .log2_chroma_w = 0,
00855 .log2_chroma_h = 0,
00856 .comp = {
00857 { 0, 1, 1, 0, 4 },
00858 { 0, 1, 1, 5, 4 },
00859 { 0, 1, 2, 2, 4 },
00860 },
00861 .flags = PIX_FMT_RGB,
00862 },
00863 [PIX_FMT_BGR444BE] = {
00864 .name = "bgr444be",
00865 .nb_components = 3,
00866 .log2_chroma_w = 0,
00867 .log2_chroma_h = 0,
00868 .comp = {
00869 { 0, 1, 1, 0, 3 },
00870 { 0, 1, 1, 4, 3 },
00871 { 0, 1, 0, 0, 3 },
00872 },
00873 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00874 },
00875 [PIX_FMT_BGR444LE] = {
00876 .name = "bgr444le",
00877 .nb_components = 3,
00878 .log2_chroma_w = 0,
00879 .log2_chroma_h = 0,
00880 .comp = {
00881 { 0, 1, 1, 0, 3 },
00882 { 0, 1, 1, 4, 3 },
00883 { 0, 1, 2, 0, 3 },
00884 },
00885 .flags = PIX_FMT_RGB,
00886 },
00887 [PIX_FMT_VAAPI_MOCO] = {
00888 .name = "vaapi_moco",
00889 .log2_chroma_w = 1,
00890 .log2_chroma_h = 1,
00891 .flags = PIX_FMT_HWACCEL,
00892 },
00893 [PIX_FMT_VAAPI_IDCT] = {
00894 .name = "vaapi_idct",
00895 .log2_chroma_w = 1,
00896 .log2_chroma_h = 1,
00897 .flags = PIX_FMT_HWACCEL,
00898 },
00899 [PIX_FMT_VAAPI_VLD] = {
00900 .name = "vaapi_vld",
00901 .log2_chroma_w = 1,
00902 .log2_chroma_h = 1,
00903 .flags = PIX_FMT_HWACCEL,
00904 },
00905 [PIX_FMT_YUV420P9LE] = {
00906 .name = "yuv420p9le",
00907 .nb_components = 3,
00908 .log2_chroma_w = 1,
00909 .log2_chroma_h = 1,
00910 .comp = {
00911 { 0, 1, 1, 0, 8 },
00912 { 1, 1, 1, 0, 8 },
00913 { 2, 1, 1, 0, 8 },
00914 },
00915 .flags = PIX_FMT_PLANAR,
00916 },
00917 [PIX_FMT_YUV420P9BE] = {
00918 .name = "yuv420p9be",
00919 .nb_components = 3,
00920 .log2_chroma_w = 1,
00921 .log2_chroma_h = 1,
00922 .comp = {
00923 { 0, 1, 1, 0, 8 },
00924 { 1, 1, 1, 0, 8 },
00925 { 2, 1, 1, 0, 8 },
00926 },
00927 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
00928 },
00929 [PIX_FMT_YUV420P10LE] = {
00930 .name = "yuv420p10le",
00931 .nb_components = 3,
00932 .log2_chroma_w = 1,
00933 .log2_chroma_h = 1,
00934 .comp = {
00935 { 0, 1, 1, 0, 9 },
00936 { 1, 1, 1, 0, 9 },
00937 { 2, 1, 1, 0, 9 },
00938 },
00939 .flags = PIX_FMT_PLANAR,
00940 },
00941 [PIX_FMT_YUV420P10BE] = {
00942 .name = "yuv420p10be",
00943 .nb_components = 3,
00944 .log2_chroma_w = 1,
00945 .log2_chroma_h = 1,
00946 .comp = {
00947 { 0, 1, 1, 0, 9 },
00948 { 1, 1, 1, 0, 9 },
00949 { 2, 1, 1, 0, 9 },
00950 },
00951 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
00952 },
00953 [PIX_FMT_YUV420P12LE] = {
00954 .name = "yuv420p12le",
00955 .nb_components = 3,
00956 .log2_chroma_w = 1,
00957 .log2_chroma_h = 1,
00958 .comp = {
00959 { 0, 1, 1, 0, 11 },
00960 { 1, 1, 1, 0, 11 },
00961 { 2, 1, 1, 0, 11 },
00962 },
00963 .flags = PIX_FMT_PLANAR,
00964 },
00965 [PIX_FMT_YUV420P12BE] = {
00966 .name = "yuv420p12be",
00967 .nb_components = 3,
00968 .log2_chroma_w = 1,
00969 .log2_chroma_h = 1,
00970 .comp = {
00971 { 0, 1, 1, 0, 11 },
00972 { 1, 1, 1, 0, 11 },
00973 { 2, 1, 1, 0, 11 },
00974 },
00975 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
00976 },
00977 [PIX_FMT_YUV420P14LE] = {
00978 .name = "yuv420p14le",
00979 .nb_components = 3,
00980 .log2_chroma_w = 1,
00981 .log2_chroma_h = 1,
00982 .comp = {
00983 { 0, 1, 1, 0, 13 },
00984 { 1, 1, 1, 0, 13 },
00985 { 2, 1, 1, 0, 13 },
00986 },
00987 .flags = PIX_FMT_PLANAR,
00988 },
00989 [PIX_FMT_YUV420P14BE] = {
00990 .name = "yuv420p14be",
00991 .nb_components = 3,
00992 .log2_chroma_w = 1,
00993 .log2_chroma_h = 1,
00994 .comp = {
00995 { 0, 1, 1, 0, 13 },
00996 { 1, 1, 1, 0, 13 },
00997 { 2, 1, 1, 0, 13 },
00998 },
00999 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01000 },
01001 [PIX_FMT_YUV420P16LE] = {
01002 .name = "yuv420p16le",
01003 .nb_components = 3,
01004 .log2_chroma_w = 1,
01005 .log2_chroma_h = 1,
01006 .comp = {
01007 { 0, 1, 1, 0, 15 },
01008 { 1, 1, 1, 0, 15 },
01009 { 2, 1, 1, 0, 15 },
01010 },
01011 .flags = PIX_FMT_PLANAR,
01012 },
01013 [PIX_FMT_YUV420P16BE] = {
01014 .name = "yuv420p16be",
01015 .nb_components = 3,
01016 .log2_chroma_w = 1,
01017 .log2_chroma_h = 1,
01018 .comp = {
01019 { 0, 1, 1, 0, 15 },
01020 { 1, 1, 1, 0, 15 },
01021 { 2, 1, 1, 0, 15 },
01022 },
01023 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01024 },
01025 [PIX_FMT_YUV422P9LE] = {
01026 .name = "yuv422p9le",
01027 .nb_components = 3,
01028 .log2_chroma_w = 1,
01029 .log2_chroma_h = 0,
01030 .comp = {
01031 { 0, 1, 1, 0, 8 },
01032 { 1, 1, 1, 0, 8 },
01033 { 2, 1, 1, 0, 8 },
01034 },
01035 .flags = PIX_FMT_PLANAR,
01036 },
01037 [PIX_FMT_YUV422P9BE] = {
01038 .name = "yuv422p9be",
01039 .nb_components = 3,
01040 .log2_chroma_w = 1,
01041 .log2_chroma_h = 0,
01042 .comp = {
01043 { 0, 1, 1, 0, 8 },
01044 { 1, 1, 1, 0, 8 },
01045 { 2, 1, 1, 0, 8 },
01046 },
01047 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01048 },
01049 [PIX_FMT_YUV422P10LE] = {
01050 .name = "yuv422p10le",
01051 .nb_components = 3,
01052 .log2_chroma_w = 1,
01053 .log2_chroma_h = 0,
01054 .comp = {
01055 { 0, 1, 1, 0, 9 },
01056 { 1, 1, 1, 0, 9 },
01057 { 2, 1, 1, 0, 9 },
01058 },
01059 .flags = PIX_FMT_PLANAR,
01060 },
01061 [PIX_FMT_YUV422P10BE] = {
01062 .name = "yuv422p10be",
01063 .nb_components = 3,
01064 .log2_chroma_w = 1,
01065 .log2_chroma_h = 0,
01066 .comp = {
01067 { 0, 1, 1, 0, 9 },
01068 { 1, 1, 1, 0, 9 },
01069 { 2, 1, 1, 0, 9 },
01070 },
01071 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01072 },
01073 [PIX_FMT_YUV422P12LE] = {
01074 .name = "yuv422p12le",
01075 .nb_components = 3,
01076 .log2_chroma_w = 1,
01077 .log2_chroma_h = 0,
01078 .comp = {
01079 { 0, 1, 1, 0, 11 },
01080 { 1, 1, 1, 0, 11 },
01081 { 2, 1, 1, 0, 11 },
01082 },
01083 .flags = PIX_FMT_PLANAR,
01084 },
01085 [PIX_FMT_YUV422P12BE] = {
01086 .name = "yuv422p12be",
01087 .nb_components = 3,
01088 .log2_chroma_w = 1,
01089 .log2_chroma_h = 0,
01090 .comp = {
01091 { 0, 1, 1, 0, 11 },
01092 { 1, 1, 1, 0, 11 },
01093 { 2, 1, 1, 0, 11 },
01094 },
01095 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01096 },
01097 [PIX_FMT_YUV422P14LE] = {
01098 .name = "yuv422p14le",
01099 .nb_components = 3,
01100 .log2_chroma_w = 1,
01101 .log2_chroma_h = 0,
01102 .comp = {
01103 { 0, 1, 1, 0, 13 },
01104 { 1, 1, 1, 0, 13 },
01105 { 2, 1, 1, 0, 13 },
01106 },
01107 .flags = PIX_FMT_PLANAR,
01108 },
01109 [PIX_FMT_YUV422P14BE] = {
01110 .name = "yuv422p14be",
01111 .nb_components = 3,
01112 .log2_chroma_w = 1,
01113 .log2_chroma_h = 0,
01114 .comp = {
01115 { 0, 1, 1, 0, 13 },
01116 { 1, 1, 1, 0, 13 },
01117 { 2, 1, 1, 0, 13 },
01118 },
01119 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01120 },
01121 [PIX_FMT_YUV422P16LE] = {
01122 .name = "yuv422p16le",
01123 .nb_components = 3,
01124 .log2_chroma_w = 1,
01125 .log2_chroma_h = 0,
01126 .comp = {
01127 { 0, 1, 1, 0, 15 },
01128 { 1, 1, 1, 0, 15 },
01129 { 2, 1, 1, 0, 15 },
01130 },
01131 .flags = PIX_FMT_PLANAR,
01132 },
01133 [PIX_FMT_YUV422P16BE] = {
01134 .name = "yuv422p16be",
01135 .nb_components = 3,
01136 .log2_chroma_w = 1,
01137 .log2_chroma_h = 0,
01138 .comp = {
01139 { 0, 1, 1, 0, 15 },
01140 { 1, 1, 1, 0, 15 },
01141 { 2, 1, 1, 0, 15 },
01142 },
01143 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01144 },
01145 [PIX_FMT_YUV444P16LE] = {
01146 .name = "yuv444p16le",
01147 .nb_components = 3,
01148 .log2_chroma_w = 0,
01149 .log2_chroma_h = 0,
01150 .comp = {
01151 { 0, 1, 1, 0, 15 },
01152 { 1, 1, 1, 0, 15 },
01153 { 2, 1, 1, 0, 15 },
01154 },
01155 .flags = PIX_FMT_PLANAR,
01156 },
01157 [PIX_FMT_YUV444P16BE] = {
01158 .name = "yuv444p16be",
01159 .nb_components = 3,
01160 .log2_chroma_w = 0,
01161 .log2_chroma_h = 0,
01162 .comp = {
01163 { 0, 1, 1, 0, 15 },
01164 { 1, 1, 1, 0, 15 },
01165 { 2, 1, 1, 0, 15 },
01166 },
01167 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01168 },
01169 [PIX_FMT_YUV444P10LE] = {
01170 .name = "yuv444p10le",
01171 .nb_components = 3,
01172 .log2_chroma_w = 0,
01173 .log2_chroma_h = 0,
01174 .comp = {
01175 { 0, 1, 1, 0, 9 },
01176 { 1, 1, 1, 0, 9 },
01177 { 2, 1, 1, 0, 9 },
01178 },
01179 .flags = PIX_FMT_PLANAR,
01180 },
01181 [PIX_FMT_YUV444P10BE] = {
01182 .name = "yuv444p10be",
01183 .nb_components = 3,
01184 .log2_chroma_w = 0,
01185 .log2_chroma_h = 0,
01186 .comp = {
01187 { 0, 1, 1, 0, 9 },
01188 { 1, 1, 1, 0, 9 },
01189 { 2, 1, 1, 0, 9 },
01190 },
01191 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01192 },
01193 [PIX_FMT_YUV444P9LE] = {
01194 .name = "yuv444p9le",
01195 .nb_components = 3,
01196 .log2_chroma_w = 0,
01197 .log2_chroma_h = 0,
01198 .comp = {
01199 { 0, 1, 1, 0, 8 },
01200 { 1, 1, 1, 0, 8 },
01201 { 2, 1, 1, 0, 8 },
01202 },
01203 .flags = PIX_FMT_PLANAR,
01204 },
01205 [PIX_FMT_YUV444P9BE] = {
01206 .name = "yuv444p9be",
01207 .nb_components = 3,
01208 .log2_chroma_w = 0,
01209 .log2_chroma_h = 0,
01210 .comp = {
01211 { 0, 1, 1, 0, 8 },
01212 { 1, 1, 1, 0, 8 },
01213 { 2, 1, 1, 0, 8 },
01214 },
01215 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01216 },
01217 [PIX_FMT_YUV444P12LE] = {
01218 .name = "yuv444p12le",
01219 .nb_components = 3,
01220 .log2_chroma_w = 0,
01221 .log2_chroma_h = 0,
01222 .comp = {
01223 { 0, 1, 1, 0, 11 },
01224 { 1, 1, 1, 0, 11 },
01225 { 2, 1, 1, 0, 11 },
01226 },
01227 .flags = PIX_FMT_PLANAR,
01228 },
01229 [PIX_FMT_YUV444P12BE] = {
01230 .name = "yuv444p12be",
01231 .nb_components = 3,
01232 .log2_chroma_w = 0,
01233 .log2_chroma_h = 0,
01234 .comp = {
01235 { 0, 1, 1, 0, 11 },
01236 { 1, 1, 1, 0, 11 },
01237 { 2, 1, 1, 0, 11 },
01238 },
01239 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01240 },
01241 [PIX_FMT_YUV444P14LE] = {
01242 .name = "yuv444p14le",
01243 .nb_components = 3,
01244 .log2_chroma_w = 0,
01245 .log2_chroma_h = 0,
01246 .comp = {
01247 { 0, 1, 1, 0, 13 },
01248 { 1, 1, 1, 0, 13 },
01249 { 2, 1, 1, 0, 13 },
01250 },
01251 .flags = PIX_FMT_PLANAR,
01252 },
01253 [PIX_FMT_YUV444P14BE] = {
01254 .name = "yuv444p14be",
01255 .nb_components = 3,
01256 .log2_chroma_w = 0,
01257 .log2_chroma_h = 0,
01258 .comp = {
01259 { 0, 1, 1, 0, 13 },
01260 { 1, 1, 1, 0, 13 },
01261 { 2, 1, 1, 0, 13 },
01262 },
01263 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01264 },
01265 [PIX_FMT_DXVA2_VLD] = {
01266 .name = "dxva2_vld",
01267 .log2_chroma_w = 1,
01268 .log2_chroma_h = 1,
01269 .flags = PIX_FMT_HWACCEL,
01270 },
01271 [PIX_FMT_VDA_VLD] = {
01272 .name = "vda_vld",
01273 .log2_chroma_w = 1,
01274 .log2_chroma_h = 1,
01275 .flags = PIX_FMT_HWACCEL,
01276 },
01277 [PIX_FMT_GRAY8A] = {
01278 .name = "gray8a",
01279 .nb_components = 2,
01280 .comp = {
01281 { 0, 1, 1, 0, 7 },
01282 { 0, 1, 2, 0, 7 },
01283 },
01284 },
01285 [PIX_FMT_GBRP] = {
01286 .name = "gbrp",
01287 .nb_components = 3,
01288 .log2_chroma_w = 0,
01289 .log2_chroma_h = 0,
01290 .comp = {
01291 { 2, 0, 1, 0, 7 },
01292 { 0, 0, 1, 0, 7 },
01293 { 1, 0, 1, 0, 7 },
01294 },
01295 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01296 },
01297 [PIX_FMT_GBRP9LE] = {
01298 .name = "gbrp9le",
01299 .nb_components = 3,
01300 .log2_chroma_w = 0,
01301 .log2_chroma_h = 0,
01302 .comp = {
01303 { 2, 1, 1, 0, 8 },
01304 { 0, 1, 1, 0, 8 },
01305 { 1, 1, 1, 0, 8 },
01306 },
01307 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01308 },
01309 [PIX_FMT_GBRP9BE] = {
01310 .name = "gbrp9be",
01311 .nb_components = 3,
01312 .log2_chroma_w = 0,
01313 .log2_chroma_h = 0,
01314 .comp = {
01315 { 2, 1, 1, 0, 8 },
01316 { 0, 1, 1, 0, 8 },
01317 { 1, 1, 1, 0, 8 },
01318 },
01319 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01320 },
01321 [PIX_FMT_GBRP10LE] = {
01322 .name = "gbrp10le",
01323 .nb_components = 3,
01324 .log2_chroma_w = 0,
01325 .log2_chroma_h = 0,
01326 .comp = {
01327 { 2, 1, 1, 0, 9 },
01328 { 0, 1, 1, 0, 9 },
01329 { 1, 1, 1, 0, 9 },
01330 },
01331 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01332 },
01333 [PIX_FMT_GBRP10BE] = {
01334 .name = "gbrp10be",
01335 .nb_components = 3,
01336 .log2_chroma_w = 0,
01337 .log2_chroma_h = 0,
01338 .comp = {
01339 { 2, 1, 1, 0, 9 },
01340 { 0, 1, 1, 0, 9 },
01341 { 1, 1, 1, 0, 9 },
01342 },
01343 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01344 },
01345 [PIX_FMT_GBRP12LE] = {
01346 .name = "gbrp12le",
01347 .nb_components = 3,
01348 .log2_chroma_w = 0,
01349 .log2_chroma_h = 0,
01350 .comp = {
01351 { 2, 1, 1, 0, 11 },
01352 { 0, 1, 1, 0, 11 },
01353 { 1, 1, 1, 0, 11 },
01354 },
01355 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01356 },
01357 [PIX_FMT_GBRP12BE] = {
01358 .name = "gbrp12be",
01359 .nb_components = 3,
01360 .log2_chroma_w = 0,
01361 .log2_chroma_h = 0,
01362 .comp = {
01363 { 2, 1, 1, 0, 11 },
01364 { 0, 1, 1, 0, 11 },
01365 { 1, 1, 1, 0, 11 },
01366 },
01367 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01368 },
01369 [PIX_FMT_GBRP14LE] = {
01370 .name = "gbrp14le",
01371 .nb_components = 3,
01372 .log2_chroma_w = 0,
01373 .log2_chroma_h = 0,
01374 .comp = {
01375 { 2, 1, 1, 0, 13 },
01376 { 0, 1, 1, 0, 13 },
01377 { 1, 1, 1, 0, 13 },
01378 },
01379 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01380 },
01381 [PIX_FMT_GBRP14BE] = {
01382 .name = "gbrp14be",
01383 .nb_components = 3,
01384 .log2_chroma_w = 0,
01385 .log2_chroma_h = 0,
01386 .comp = {
01387 { 2, 1, 1, 0, 13 },
01388 { 0, 1, 1, 0, 13 },
01389 { 1, 1, 1, 0, 13 },
01390 },
01391 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01392 },
01393 [PIX_FMT_GBRP16LE] = {
01394 .name = "gbrp16le",
01395 .nb_components = 3,
01396 .log2_chroma_w = 0,
01397 .log2_chroma_h = 0,
01398 .comp = {
01399 { 2, 1, 1, 0, 15 },
01400 { 0, 1, 1, 0, 15 },
01401 { 1, 1, 1, 0, 15 },
01402 },
01403 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01404 },
01405 [PIX_FMT_GBRP16BE] = {
01406 .name = "gbrp16be",
01407 .nb_components = 3,
01408 .log2_chroma_w = 0,
01409 .log2_chroma_h = 0,
01410 .comp = {
01411 { 2, 1, 1, 0, 15 },
01412 { 0, 1, 1, 0, 15 },
01413 { 1, 1, 1, 0, 15 },
01414 },
01415 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01416 },
01417 };
01418
01419 static enum PixelFormat get_pix_fmt_internal(const char *name)
01420 {
01421 enum PixelFormat pix_fmt;
01422
01423 for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
01424 if (av_pix_fmt_descriptors[pix_fmt].name &&
01425 !strcmp(av_pix_fmt_descriptors[pix_fmt].name, name))
01426 return pix_fmt;
01427
01428 return PIX_FMT_NONE;
01429 }
01430
01431 const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt)
01432 {
01433 return (unsigned)pix_fmt < PIX_FMT_NB ?
01434 av_pix_fmt_descriptors[pix_fmt].name : NULL;
01435 }
01436
01437 #if HAVE_BIGENDIAN
01438 # define X_NE(be, le) be
01439 #else
01440 # define X_NE(be, le) le
01441 #endif
01442
01443 enum PixelFormat av_get_pix_fmt(const char *name)
01444 {
01445 enum PixelFormat pix_fmt;
01446
01447 if (!strcmp(name, "rgb32"))
01448 name = X_NE("argb", "bgra");
01449 else if (!strcmp(name, "bgr32"))
01450 name = X_NE("abgr", "rgba");
01451
01452 pix_fmt = get_pix_fmt_internal(name);
01453 if (pix_fmt == PIX_FMT_NONE) {
01454 char name2[32];
01455
01456 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
01457 pix_fmt = get_pix_fmt_internal(name2);
01458 }
01459 return pix_fmt;
01460 }
01461
01462 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
01463 {
01464 int c, bits = 0;
01465 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
01466
01467 for (c = 0; c < pixdesc->nb_components; c++) {
01468 int s = c == 1 || c == 2 ? 0 : log2_pixels;
01469 bits += (pixdesc->comp[c].depth_minus1 + 1) << s;
01470 }
01471
01472 return bits >> log2_pixels;
01473 }
01474
01475 char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
01476 {
01477
01478 if (pix_fmt < 0) {
01479 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
01480 } else {
01481 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
01482 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
01483 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
01484 }
01485
01486 return buf;
01487 }