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
00025 #include "common.h"
00026 #include "pixfmt.h"
00027 #include "pixdesc.h"
00028
00029 #include "intreadwrite.h"
00030
00031 void av_read_image_line(uint16_t *dst,
00032 const uint8_t *data[4], const int linesize[4],
00033 const AVPixFmtDescriptor *desc,
00034 int x, int y, int c, int w,
00035 int read_pal_component)
00036 {
00037 AVComponentDescriptor comp = desc->comp[c];
00038 int plane = comp.plane;
00039 int depth = comp.depth_minus1 + 1;
00040 int mask = (1 << depth) - 1;
00041 int shift = comp.shift;
00042 int step = comp.step_minus1 + 1;
00043 int flags = desc->flags;
00044
00045 if (flags & PIX_FMT_BITSTREAM) {
00046 int skip = x * step + comp.offset_plus1 - 1;
00047 const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
00048 int shift = 8 - depth - (skip & 7);
00049
00050 while (w--) {
00051 int val = (*p >> shift) & mask;
00052 if (read_pal_component)
00053 val = data[1][4*val + c];
00054 shift -= step;
00055 p -= shift >> 3;
00056 shift &= 7;
00057 *dst++ = val;
00058 }
00059 } else {
00060 const uint8_t *p = data[plane] + y * linesize[plane] +
00061 x * step + comp.offset_plus1 - 1;
00062 int is_8bit = shift + depth <= 8;
00063
00064 if (is_8bit)
00065 p += !!(flags & PIX_FMT_BE);
00066
00067 while (w--) {
00068 int val = is_8bit ? *p :
00069 flags & PIX_FMT_BE ? AV_RB16(p) : AV_RL16(p);
00070 val = (val >> shift) & mask;
00071 if (read_pal_component)
00072 val = data[1][4 * val + c];
00073 p += step;
00074 *dst++ = val;
00075 }
00076 }
00077 }
00078
00079 void av_write_image_line(const uint16_t *src,
00080 uint8_t *data[4], const int linesize[4],
00081 const AVPixFmtDescriptor *desc,
00082 int x, int y, int c, int w)
00083 {
00084 AVComponentDescriptor comp = desc->comp[c];
00085 int plane = comp.plane;
00086 int depth = comp.depth_minus1 + 1;
00087 int step = comp.step_minus1 + 1;
00088 int flags = desc->flags;
00089
00090 if (flags & PIX_FMT_BITSTREAM) {
00091 int skip = x * step + comp.offset_plus1 - 1;
00092 uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
00093 int shift = 8 - depth - (skip & 7);
00094
00095 while (w--) {
00096 *p |= *src++ << shift;
00097 shift -= step;
00098 p -= shift >> 3;
00099 shift &= 7;
00100 }
00101 } else {
00102 int shift = comp.shift;
00103 uint8_t *p = data[plane] + y * linesize[plane] +
00104 x * step + comp.offset_plus1 - 1;
00105
00106 if (shift + depth <= 8) {
00107 p += !!(flags & PIX_FMT_BE);
00108 while (w--) {
00109 *p |= (*src++ << shift);
00110 p += step;
00111 }
00112 } else {
00113 while (w--) {
00114 if (flags & PIX_FMT_BE) {
00115 uint16_t val = AV_RB16(p) | (*src++ << shift);
00116 AV_WB16(p, val);
00117 } else {
00118 uint16_t val = AV_RL16(p) | (*src++ << shift);
00119 AV_WL16(p, val);
00120 }
00121 p += step;
00122 }
00123 }
00124 }
00125 }
00126
00127 #if !FF_API_PIX_FMT_DESC
00128 static
00129 #endif
00130 const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
00131 [AV_PIX_FMT_YUV420P] = {
00132 .name = "yuv420p",
00133 .nb_components = 3,
00134 .log2_chroma_w = 1,
00135 .log2_chroma_h = 1,
00136 .comp = {
00137 { 0, 0, 1, 0, 7 },
00138 { 1, 0, 1, 0, 7 },
00139 { 2, 0, 1, 0, 7 },
00140 },
00141 .flags = PIX_FMT_PLANAR,
00142 },
00143 [AV_PIX_FMT_YUYV422] = {
00144 .name = "yuyv422",
00145 .nb_components = 3,
00146 .log2_chroma_w = 1,
00147 .log2_chroma_h = 0,
00148 .comp = {
00149 { 0, 1, 1, 0, 7 },
00150 { 0, 3, 2, 0, 7 },
00151 { 0, 3, 4, 0, 7 },
00152 },
00153 },
00154 [AV_PIX_FMT_RGB24] = {
00155 .name = "rgb24",
00156 .nb_components = 3,
00157 .log2_chroma_w = 0,
00158 .log2_chroma_h = 0,
00159 .comp = {
00160 { 0, 2, 1, 0, 7 },
00161 { 0, 2, 2, 0, 7 },
00162 { 0, 2, 3, 0, 7 },
00163 },
00164 .flags = PIX_FMT_RGB,
00165 },
00166 [AV_PIX_FMT_BGR24] = {
00167 .name = "bgr24",
00168 .nb_components = 3,
00169 .log2_chroma_w = 0,
00170 .log2_chroma_h = 0,
00171 .comp = {
00172 { 0, 2, 3, 0, 7 },
00173 { 0, 2, 2, 0, 7 },
00174 { 0, 2, 1, 0, 7 },
00175 },
00176 .flags = PIX_FMT_RGB,
00177 },
00178 [AV_PIX_FMT_YUV422P] = {
00179 .name = "yuv422p",
00180 .nb_components = 3,
00181 .log2_chroma_w = 1,
00182 .log2_chroma_h = 0,
00183 .comp = {
00184 { 0, 0, 1, 0, 7 },
00185 { 1, 0, 1, 0, 7 },
00186 { 2, 0, 1, 0, 7 },
00187 },
00188 .flags = PIX_FMT_PLANAR,
00189 },
00190 [AV_PIX_FMT_YUV444P] = {
00191 .name = "yuv444p",
00192 .nb_components = 3,
00193 .log2_chroma_w = 0,
00194 .log2_chroma_h = 0,
00195 .comp = {
00196 { 0, 0, 1, 0, 7 },
00197 { 1, 0, 1, 0, 7 },
00198 { 2, 0, 1, 0, 7 },
00199 },
00200 .flags = PIX_FMT_PLANAR,
00201 },
00202 [AV_PIX_FMT_YUV410P] = {
00203 .name = "yuv410p",
00204 .nb_components = 3,
00205 .log2_chroma_w = 2,
00206 .log2_chroma_h = 2,
00207 .comp = {
00208 { 0, 0, 1, 0, 7 },
00209 { 1, 0, 1, 0, 7 },
00210 { 2, 0, 1, 0, 7 },
00211 },
00212 .flags = PIX_FMT_PLANAR,
00213 },
00214 [AV_PIX_FMT_YUV411P] = {
00215 .name = "yuv411p",
00216 .nb_components = 3,
00217 .log2_chroma_w = 2,
00218 .log2_chroma_h = 0,
00219 .comp = {
00220 { 0, 0, 1, 0, 7 },
00221 { 1, 0, 1, 0, 7 },
00222 { 2, 0, 1, 0, 7 },
00223 },
00224 .flags = PIX_FMT_PLANAR,
00225 },
00226 [AV_PIX_FMT_GRAY8] = {
00227 .name = "gray",
00228 .nb_components = 1,
00229 .log2_chroma_w = 0,
00230 .log2_chroma_h = 0,
00231 .comp = {
00232 { 0, 0, 1, 0, 7 },
00233 },
00234 .flags = PIX_FMT_PSEUDOPAL,
00235 },
00236 [AV_PIX_FMT_MONOWHITE] = {
00237 .name = "monow",
00238 .nb_components = 1,
00239 .log2_chroma_w = 0,
00240 .log2_chroma_h = 0,
00241 .comp = {
00242 { 0, 0, 1, 0, 0 },
00243 },
00244 .flags = PIX_FMT_BITSTREAM,
00245 },
00246 [AV_PIX_FMT_MONOBLACK] = {
00247 .name = "monob",
00248 .nb_components = 1,
00249 .log2_chroma_w = 0,
00250 .log2_chroma_h = 0,
00251 .comp = {
00252 { 0, 0, 1, 7, 0 },
00253 },
00254 .flags = PIX_FMT_BITSTREAM,
00255 },
00256 [AV_PIX_FMT_PAL8] = {
00257 .name = "pal8",
00258 .nb_components = 1,
00259 .log2_chroma_w = 0,
00260 .log2_chroma_h = 0,
00261 .comp = {
00262 { 0, 0, 1, 0, 7 },
00263 },
00264 .flags = PIX_FMT_PAL,
00265 },
00266 [AV_PIX_FMT_YUVJ420P] = {
00267 .name = "yuvj420p",
00268 .nb_components = 3,
00269 .log2_chroma_w = 1,
00270 .log2_chroma_h = 1,
00271 .comp = {
00272 { 0, 0, 1, 0, 7 },
00273 { 1, 0, 1, 0, 7 },
00274 { 2, 0, 1, 0, 7 },
00275 },
00276 .flags = PIX_FMT_PLANAR,
00277 },
00278 [AV_PIX_FMT_YUVJ422P] = {
00279 .name = "yuvj422p",
00280 .nb_components = 3,
00281 .log2_chroma_w = 1,
00282 .log2_chroma_h = 0,
00283 .comp = {
00284 { 0, 0, 1, 0, 7 },
00285 { 1, 0, 1, 0, 7 },
00286 { 2, 0, 1, 0, 7 },
00287 },
00288 .flags = PIX_FMT_PLANAR,
00289 },
00290 [AV_PIX_FMT_YUVJ444P] = {
00291 .name = "yuvj444p",
00292 .nb_components = 3,
00293 .log2_chroma_w = 0,
00294 .log2_chroma_h = 0,
00295 .comp = {
00296 { 0, 0, 1, 0, 7 },
00297 { 1, 0, 1, 0, 7 },
00298 { 2, 0, 1, 0, 7 },
00299 },
00300 .flags = PIX_FMT_PLANAR,
00301 },
00302 [AV_PIX_FMT_XVMC_MPEG2_MC] = {
00303 .name = "xvmcmc",
00304 .flags = PIX_FMT_HWACCEL,
00305 },
00306 [AV_PIX_FMT_XVMC_MPEG2_IDCT] = {
00307 .name = "xvmcidct",
00308 .flags = PIX_FMT_HWACCEL,
00309 },
00310 [AV_PIX_FMT_UYVY422] = {
00311 .name = "uyvy422",
00312 .nb_components = 3,
00313 .log2_chroma_w = 1,
00314 .log2_chroma_h = 0,
00315 .comp = {
00316 { 0, 1, 2, 0, 7 },
00317 { 0, 3, 1, 0, 7 },
00318 { 0, 3, 3, 0, 7 },
00319 },
00320 },
00321 [AV_PIX_FMT_UYYVYY411] = {
00322 .name = "uyyvyy411",
00323 .nb_components = 3,
00324 .log2_chroma_w = 2,
00325 .log2_chroma_h = 0,
00326 .comp = {
00327 { 0, 3, 2, 0, 7 },
00328 { 0, 5, 1, 0, 7 },
00329 { 0, 5, 4, 0, 7 },
00330 },
00331 },
00332 [AV_PIX_FMT_BGR8] = {
00333 .name = "bgr8",
00334 .nb_components = 3,
00335 .log2_chroma_w = 0,
00336 .log2_chroma_h = 0,
00337 .comp = {
00338 { 0, 0, 1, 0, 2 },
00339 { 0, 0, 1, 3, 2 },
00340 { 0, 0, 1, 6, 1 },
00341 },
00342 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
00343 },
00344 [AV_PIX_FMT_BGR4] = {
00345 .name = "bgr4",
00346 .nb_components = 3,
00347 .log2_chroma_w = 0,
00348 .log2_chroma_h = 0,
00349 .comp = {
00350 { 0, 3, 4, 0, 0 },
00351 { 0, 3, 2, 0, 1 },
00352 { 0, 3, 1, 0, 0 },
00353 },
00354 .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
00355 },
00356 [AV_PIX_FMT_BGR4_BYTE] = {
00357 .name = "bgr4_byte",
00358 .nb_components = 3,
00359 .log2_chroma_w = 0,
00360 .log2_chroma_h = 0,
00361 .comp = {
00362 { 0, 0, 1, 0, 0 },
00363 { 0, 0, 1, 1, 1 },
00364 { 0, 0, 1, 3, 0 },
00365 },
00366 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
00367 },
00368 [AV_PIX_FMT_RGB8] = {
00369 .name = "rgb8",
00370 .nb_components = 3,
00371 .log2_chroma_w = 0,
00372 .log2_chroma_h = 0,
00373 .comp = {
00374 { 0, 0, 1, 6, 1 },
00375 { 0, 0, 1, 3, 2 },
00376 { 0, 0, 1, 0, 2 },
00377 },
00378 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
00379 },
00380 [AV_PIX_FMT_RGB4] = {
00381 .name = "rgb4",
00382 .nb_components = 3,
00383 .log2_chroma_w = 0,
00384 .log2_chroma_h = 0,
00385 .comp = {
00386 { 0, 3, 1, 0, 0 },
00387 { 0, 3, 2, 0, 1 },
00388 { 0, 3, 4, 0, 0 },
00389 },
00390 .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
00391 },
00392 [AV_PIX_FMT_RGB4_BYTE] = {
00393 .name = "rgb4_byte",
00394 .nb_components = 3,
00395 .log2_chroma_w = 0,
00396 .log2_chroma_h = 0,
00397 .comp = {
00398 { 0, 0, 1, 3, 0 },
00399 { 0, 0, 1, 1, 1 },
00400 { 0, 0, 1, 0, 0 },
00401 },
00402 .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
00403 },
00404 [AV_PIX_FMT_NV12] = {
00405 .name = "nv12",
00406 .nb_components = 3,
00407 .log2_chroma_w = 1,
00408 .log2_chroma_h = 1,
00409 .comp = {
00410 { 0, 0, 1, 0, 7 },
00411 { 1, 1, 1, 0, 7 },
00412 { 1, 1, 2, 0, 7 },
00413 },
00414 .flags = PIX_FMT_PLANAR,
00415 },
00416 [AV_PIX_FMT_NV21] = {
00417 .name = "nv21",
00418 .nb_components = 3,
00419 .log2_chroma_w = 1,
00420 .log2_chroma_h = 1,
00421 .comp = {
00422 { 0, 0, 1, 0, 7 },
00423 { 1, 1, 2, 0, 7 },
00424 { 1, 1, 1, 0, 7 },
00425 },
00426 .flags = PIX_FMT_PLANAR,
00427 },
00428 [AV_PIX_FMT_ARGB] = {
00429 .name = "argb",
00430 .nb_components = 4,
00431 .log2_chroma_w = 0,
00432 .log2_chroma_h = 0,
00433 .comp = {
00434 { 0, 3, 2, 0, 7 },
00435 { 0, 3, 3, 0, 7 },
00436 { 0, 3, 4, 0, 7 },
00437 { 0, 3, 1, 0, 7 },
00438 },
00439 .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
00440 },
00441 [AV_PIX_FMT_RGBA] = {
00442 .name = "rgba",
00443 .nb_components = 4,
00444 .log2_chroma_w = 0,
00445 .log2_chroma_h = 0,
00446 .comp = {
00447 { 0, 3, 1, 0, 7 },
00448 { 0, 3, 2, 0, 7 },
00449 { 0, 3, 3, 0, 7 },
00450 { 0, 3, 4, 0, 7 },
00451 },
00452 .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
00453 },
00454 [AV_PIX_FMT_ABGR] = {
00455 .name = "abgr",
00456 .nb_components = 4,
00457 .log2_chroma_w = 0,
00458 .log2_chroma_h = 0,
00459 .comp = {
00460 { 0, 3, 4, 0, 7 },
00461 { 0, 3, 3, 0, 7 },
00462 { 0, 3, 2, 0, 7 },
00463 { 0, 3, 1, 0, 7 },
00464 },
00465 .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
00466 },
00467 [AV_PIX_FMT_BGRA] = {
00468 .name = "bgra",
00469 .nb_components = 4,
00470 .log2_chroma_w = 0,
00471 .log2_chroma_h = 0,
00472 .comp = {
00473 { 0, 3, 3, 0, 7 },
00474 { 0, 3, 2, 0, 7 },
00475 { 0, 3, 1, 0, 7 },
00476 { 0, 3, 4, 0, 7 },
00477 },
00478 .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
00479 },
00480 [AV_PIX_FMT_0RGB] = {
00481 .name = "0rgb",
00482 .nb_components= 3,
00483 .log2_chroma_w= 0,
00484 .log2_chroma_h= 0,
00485 .comp = {
00486 { 0, 3, 2, 0, 7 },
00487 { 0, 3, 3, 0, 7 },
00488 { 0, 3, 4, 0, 7 },
00489 },
00490 .flags = PIX_FMT_RGB,
00491 },
00492 [AV_PIX_FMT_RGB0] = {
00493 .name = "rgb0",
00494 .nb_components= 3,
00495 .log2_chroma_w= 0,
00496 .log2_chroma_h= 0,
00497 .comp = {
00498 { 0, 3, 1, 0, 7 },
00499 { 0, 3, 2, 0, 7 },
00500 { 0, 3, 3, 0, 7 },
00501 { 0, 3, 4, 0, 7 },
00502 },
00503 .flags = PIX_FMT_RGB,
00504 },
00505 [AV_PIX_FMT_0BGR] = {
00506 .name = "0bgr",
00507 .nb_components= 3,
00508 .log2_chroma_w= 0,
00509 .log2_chroma_h= 0,
00510 .comp = {
00511 { 0, 3, 4, 0, 7 },
00512 { 0, 3, 3, 0, 7 },
00513 { 0, 3, 2, 0, 7 },
00514 },
00515 .flags = PIX_FMT_RGB,
00516 },
00517 [AV_PIX_FMT_BGR0] = {
00518 .name = "bgr0",
00519 .nb_components= 3,
00520 .log2_chroma_w= 0,
00521 .log2_chroma_h= 0,
00522 .comp = {
00523 { 0, 3, 3, 0, 7 },
00524 { 0, 3, 2, 0, 7 },
00525 { 0, 3, 1, 0, 7 },
00526 { 0, 3, 4, 0, 7 },
00527 },
00528 .flags = PIX_FMT_RGB,
00529 },
00530 [AV_PIX_FMT_GRAY16BE] = {
00531 .name = "gray16be",
00532 .nb_components = 1,
00533 .log2_chroma_w = 0,
00534 .log2_chroma_h = 0,
00535 .comp = {
00536 { 0, 1, 1, 0, 15 },
00537 },
00538 .flags = PIX_FMT_BE,
00539 },
00540 [AV_PIX_FMT_GRAY16LE] = {
00541 .name = "gray16le",
00542 .nb_components = 1,
00543 .log2_chroma_w = 0,
00544 .log2_chroma_h = 0,
00545 .comp = {
00546 { 0, 1, 1, 0, 15 },
00547 },
00548 },
00549 [AV_PIX_FMT_YUV440P] = {
00550 .name = "yuv440p",
00551 .nb_components = 3,
00552 .log2_chroma_w = 0,
00553 .log2_chroma_h = 1,
00554 .comp = {
00555 { 0, 0, 1, 0, 7 },
00556 { 1, 0, 1, 0, 7 },
00557 { 2, 0, 1, 0, 7 },
00558 },
00559 .flags = PIX_FMT_PLANAR,
00560 },
00561 [AV_PIX_FMT_YUVJ440P] = {
00562 .name = "yuvj440p",
00563 .nb_components = 3,
00564 .log2_chroma_w = 0,
00565 .log2_chroma_h = 1,
00566 .comp = {
00567 { 0, 0, 1, 0, 7 },
00568 { 1, 0, 1, 0, 7 },
00569 { 2, 0, 1, 0, 7 },
00570 },
00571 .flags = PIX_FMT_PLANAR,
00572 },
00573 [AV_PIX_FMT_YUVA420P] = {
00574 .name = "yuva420p",
00575 .nb_components = 4,
00576 .log2_chroma_w = 1,
00577 .log2_chroma_h = 1,
00578 .comp = {
00579 { 0, 0, 1, 0, 7 },
00580 { 1, 0, 1, 0, 7 },
00581 { 2, 0, 1, 0, 7 },
00582 { 3, 0, 1, 0, 7 },
00583 },
00584 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00585 },
00586 [AV_PIX_FMT_YUVA422P] = {
00587 .name = "yuva422p",
00588 .nb_components = 4,
00589 .log2_chroma_w = 1,
00590 .log2_chroma_h = 0,
00591 .comp = {
00592 { 0, 0, 1, 0, 7 },
00593 { 1, 0, 1, 0, 7 },
00594 { 2, 0, 1, 0, 7 },
00595 { 3, 0, 1, 0, 7 },
00596 },
00597 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00598 },
00599 [AV_PIX_FMT_YUVA444P] = {
00600 .name = "yuva444p",
00601 .nb_components = 4,
00602 .log2_chroma_w = 0,
00603 .log2_chroma_h = 0,
00604 .comp = {
00605 { 0, 0, 1, 0, 7 },
00606 { 1, 0, 1, 0, 7 },
00607 { 2, 0, 1, 0, 7 },
00608 { 3, 0, 1, 0, 7 },
00609 },
00610 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00611 },
00612 [AV_PIX_FMT_YUVA420P9BE] = {
00613 .name = "yuva420p9be",
00614 .nb_components = 4,
00615 .log2_chroma_w = 1,
00616 .log2_chroma_h = 1,
00617 .comp = {
00618 { 0, 1, 1, 0, 8 },
00619 { 1, 1, 1, 0, 8 },
00620 { 2, 1, 1, 0, 8 },
00621 { 3, 1, 1, 0, 8 },
00622 },
00623 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00624 },
00625 [AV_PIX_FMT_YUVA420P9LE] = {
00626 .name = "yuva420p9le",
00627 .nb_components = 4,
00628 .log2_chroma_w = 1,
00629 .log2_chroma_h = 1,
00630 .comp = {
00631 { 0, 1, 1, 0, 8 },
00632 { 1, 1, 1, 0, 8 },
00633 { 2, 1, 1, 0, 8 },
00634 { 3, 1, 1, 0, 8 },
00635 },
00636 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00637 },
00638 [AV_PIX_FMT_YUVA422P9BE] = {
00639 .name = "yuva422p9be",
00640 .nb_components = 4,
00641 .log2_chroma_w = 1,
00642 .log2_chroma_h = 0,
00643 .comp = {
00644 { 0, 1, 1, 0, 8 },
00645 { 1, 1, 1, 0, 8 },
00646 { 2, 1, 1, 0, 8 },
00647 { 3, 1, 1, 0, 8 },
00648 },
00649 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00650 },
00651 [AV_PIX_FMT_YUVA422P9LE] = {
00652 .name = "yuva422p9le",
00653 .nb_components = 4,
00654 .log2_chroma_w = 1,
00655 .log2_chroma_h = 0,
00656 .comp = {
00657 { 0, 1, 1, 0, 8 },
00658 { 1, 1, 1, 0, 8 },
00659 { 2, 1, 1, 0, 8 },
00660 { 3, 1, 1, 0, 8 },
00661 },
00662 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00663 },
00664 [AV_PIX_FMT_YUVA444P9BE] = {
00665 .name = "yuva444p9be",
00666 .nb_components = 4,
00667 .log2_chroma_w = 0,
00668 .log2_chroma_h = 0,
00669 .comp = {
00670 { 0, 1, 1, 0, 8 },
00671 { 1, 1, 1, 0, 8 },
00672 { 2, 1, 1, 0, 8 },
00673 { 3, 1, 1, 0, 8 },
00674 },
00675 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00676 },
00677 [AV_PIX_FMT_YUVA444P9LE] = {
00678 .name = "yuva444p9le",
00679 .nb_components = 4,
00680 .log2_chroma_w = 0,
00681 .log2_chroma_h = 0,
00682 .comp = {
00683 { 0, 1, 1, 0, 8 },
00684 { 1, 1, 1, 0, 8 },
00685 { 2, 1, 1, 0, 8 },
00686 { 3, 1, 1, 0, 8 },
00687 },
00688 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00689 },
00690 [AV_PIX_FMT_YUVA420P10BE] = {
00691 .name = "yuva420p10be",
00692 .nb_components = 4,
00693 .log2_chroma_w = 1,
00694 .log2_chroma_h = 1,
00695 .comp = {
00696 { 0, 1, 1, 0, 9 },
00697 { 1, 1, 1, 0, 9 },
00698 { 2, 1, 1, 0, 9 },
00699 { 3, 1, 1, 0, 9 },
00700 },
00701 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00702 },
00703 [AV_PIX_FMT_YUVA420P10LE] = {
00704 .name = "yuva420p10le",
00705 .nb_components = 4,
00706 .log2_chroma_w = 1,
00707 .log2_chroma_h = 1,
00708 .comp = {
00709 { 0, 1, 1, 0, 9 },
00710 { 1, 1, 1, 0, 9 },
00711 { 2, 1, 1, 0, 9 },
00712 { 3, 1, 1, 0, 9 },
00713 },
00714 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00715 },
00716 [AV_PIX_FMT_YUVA422P10BE] = {
00717 .name = "yuva422p10be",
00718 .nb_components = 4,
00719 .log2_chroma_w = 1,
00720 .log2_chroma_h = 0,
00721 .comp = {
00722 { 0, 1, 1, 0, 9 },
00723 { 1, 1, 1, 0, 9 },
00724 { 2, 1, 1, 0, 9 },
00725 { 3, 1, 1, 0, 9 },
00726 },
00727 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00728 },
00729 [AV_PIX_FMT_YUVA422P10LE] = {
00730 .name = "yuva422p10le",
00731 .nb_components = 4,
00732 .log2_chroma_w = 1,
00733 .log2_chroma_h = 0,
00734 .comp = {
00735 { 0, 1, 1, 0, 9 },
00736 { 1, 1, 1, 0, 9 },
00737 { 2, 1, 1, 0, 9 },
00738 { 3, 1, 1, 0, 9 },
00739 },
00740 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00741 },
00742 [AV_PIX_FMT_YUVA444P10BE] = {
00743 .name = "yuva444p10be",
00744 .nb_components = 4,
00745 .log2_chroma_w = 0,
00746 .log2_chroma_h = 0,
00747 .comp = {
00748 { 0, 1, 1, 0, 9 },
00749 { 1, 1, 1, 0, 9 },
00750 { 2, 1, 1, 0, 9 },
00751 { 3, 1, 1, 0, 9 },
00752 },
00753 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00754 },
00755 [AV_PIX_FMT_YUVA444P10LE] = {
00756 .name = "yuva444p10le",
00757 .nb_components = 4,
00758 .log2_chroma_w = 0,
00759 .log2_chroma_h = 0,
00760 .comp = {
00761 { 0, 1, 1, 0, 9 },
00762 { 1, 1, 1, 0, 9 },
00763 { 2, 1, 1, 0, 9 },
00764 { 3, 1, 1, 0, 9 },
00765 },
00766 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00767 },
00768 [AV_PIX_FMT_YUVA420P16BE] = {
00769 .name = "yuva420p16be",
00770 .nb_components = 4,
00771 .log2_chroma_w = 1,
00772 .log2_chroma_h = 1,
00773 .comp = {
00774 { 0, 1, 1, 0, 15 },
00775 { 1, 1, 1, 0, 15 },
00776 { 2, 1, 1, 0, 15 },
00777 { 3, 1, 1, 0, 15 },
00778 },
00779 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00780 },
00781 [AV_PIX_FMT_YUVA420P16LE] = {
00782 .name = "yuva420p16le",
00783 .nb_components = 4,
00784 .log2_chroma_w = 1,
00785 .log2_chroma_h = 1,
00786 .comp = {
00787 { 0, 1, 1, 0, 15 },
00788 { 1, 1, 1, 0, 15 },
00789 { 2, 1, 1, 0, 15 },
00790 { 3, 1, 1, 0, 15 },
00791 },
00792 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00793 },
00794 [AV_PIX_FMT_YUVA422P16BE] = {
00795 .name = "yuva422p16be",
00796 .nb_components = 4,
00797 .log2_chroma_w = 1,
00798 .log2_chroma_h = 0,
00799 .comp = {
00800 { 0, 1, 1, 0, 15 },
00801 { 1, 1, 1, 0, 15 },
00802 { 2, 1, 1, 0, 15 },
00803 { 3, 1, 1, 0, 15 },
00804 },
00805 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00806 },
00807 [AV_PIX_FMT_YUVA422P16LE] = {
00808 .name = "yuva422p16le",
00809 .nb_components = 4,
00810 .log2_chroma_w = 1,
00811 .log2_chroma_h = 0,
00812 .comp = {
00813 { 0, 1, 1, 0, 15 },
00814 { 1, 1, 1, 0, 15 },
00815 { 2, 1, 1, 0, 15 },
00816 { 3, 1, 1, 0, 15 },
00817 },
00818 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00819 },
00820 [AV_PIX_FMT_YUVA444P16BE] = {
00821 .name = "yuva444p16be",
00822 .nb_components = 4,
00823 .log2_chroma_w = 0,
00824 .log2_chroma_h = 0,
00825 .comp = {
00826 { 0, 1, 1, 0, 15 },
00827 { 1, 1, 1, 0, 15 },
00828 { 2, 1, 1, 0, 15 },
00829 { 3, 1, 1, 0, 15 },
00830 },
00831 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00832 },
00833 [AV_PIX_FMT_YUVA444P16LE] = {
00834 .name = "yuva444p16le",
00835 .nb_components = 4,
00836 .log2_chroma_w = 0,
00837 .log2_chroma_h = 0,
00838 .comp = {
00839 { 0, 1, 1, 0, 15 },
00840 { 1, 1, 1, 0, 15 },
00841 { 2, 1, 1, 0, 15 },
00842 { 3, 1, 1, 0, 15 },
00843 },
00844 .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
00845 },
00846 [AV_PIX_FMT_VDPAU_H264] = {
00847 .name = "vdpau_h264",
00848 .log2_chroma_w = 1,
00849 .log2_chroma_h = 1,
00850 .flags = PIX_FMT_HWACCEL,
00851 },
00852 [AV_PIX_FMT_VDPAU_MPEG1] = {
00853 .name = "vdpau_mpeg1",
00854 .log2_chroma_w = 1,
00855 .log2_chroma_h = 1,
00856 .flags = PIX_FMT_HWACCEL,
00857 },
00858 [AV_PIX_FMT_VDPAU_MPEG2] = {
00859 .name = "vdpau_mpeg2",
00860 .log2_chroma_w = 1,
00861 .log2_chroma_h = 1,
00862 .flags = PIX_FMT_HWACCEL,
00863 },
00864 [AV_PIX_FMT_VDPAU_WMV3] = {
00865 .name = "vdpau_wmv3",
00866 .log2_chroma_w = 1,
00867 .log2_chroma_h = 1,
00868 .flags = PIX_FMT_HWACCEL,
00869 },
00870 [AV_PIX_FMT_VDPAU_VC1] = {
00871 .name = "vdpau_vc1",
00872 .log2_chroma_w = 1,
00873 .log2_chroma_h = 1,
00874 .flags = PIX_FMT_HWACCEL,
00875 },
00876 [AV_PIX_FMT_VDPAU_MPEG4] = {
00877 .name = "vdpau_mpeg4",
00878 .log2_chroma_w = 1,
00879 .log2_chroma_h = 1,
00880 .flags = PIX_FMT_HWACCEL,
00881 },
00882 [AV_PIX_FMT_RGB48BE] = {
00883 .name = "rgb48be",
00884 .nb_components = 3,
00885 .log2_chroma_w = 0,
00886 .log2_chroma_h = 0,
00887 .comp = {
00888 { 0, 5, 1, 0, 15 },
00889 { 0, 5, 3, 0, 15 },
00890 { 0, 5, 5, 0, 15 },
00891 },
00892 .flags = PIX_FMT_RGB | PIX_FMT_BE,
00893 },
00894 [AV_PIX_FMT_RGB48LE] = {
00895 .name = "rgb48le",
00896 .nb_components = 3,
00897 .log2_chroma_w = 0,
00898 .log2_chroma_h = 0,
00899 .comp = {
00900 { 0, 5, 1, 0, 15 },
00901 { 0, 5, 3, 0, 15 },
00902 { 0, 5, 5, 0, 15 },
00903 },
00904 .flags = PIX_FMT_RGB,
00905 },
00906 [AV_PIX_FMT_RGBA64BE] = {
00907 .name = "rgba64be",
00908 .nb_components= 4,
00909 .log2_chroma_w= 0,
00910 .log2_chroma_h= 0,
00911 .comp = {
00912 { 0, 7, 1, 0, 15 },
00913 { 0, 7, 3, 0, 15 },
00914 { 0, 7, 5, 0, 15 },
00915 { 0, 7, 7, 0, 15 },
00916 },
00917 .flags = PIX_FMT_RGB | PIX_FMT_BE | PIX_FMT_ALPHA,
00918 },
00919 [AV_PIX_FMT_RGBA64LE] = {
00920 .name = "rgba64le",
00921 .nb_components= 4,
00922 .log2_chroma_w= 0,
00923 .log2_chroma_h= 0,
00924 .comp = {
00925 { 0, 7, 1, 0, 15 },
00926 { 0, 7, 3, 0, 15 },
00927 { 0, 7, 5, 0, 15 },
00928 { 0, 7, 7, 0, 15 },
00929 },
00930 .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
00931 },
00932 [AV_PIX_FMT_RGB565BE] = {
00933 .name = "rgb565be",
00934 .nb_components = 3,
00935 .log2_chroma_w = 0,
00936 .log2_chroma_h = 0,
00937 .comp = {
00938 { 0, 1, 0, 3, 4 },
00939 { 0, 1, 1, 5, 5 },
00940 { 0, 1, 1, 0, 4 },
00941 },
00942 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00943 },
00944 [AV_PIX_FMT_RGB565LE] = {
00945 .name = "rgb565le",
00946 .nb_components = 3,
00947 .log2_chroma_w = 0,
00948 .log2_chroma_h = 0,
00949 .comp = {
00950 { 0, 1, 2, 3, 4 },
00951 { 0, 1, 1, 5, 5 },
00952 { 0, 1, 1, 0, 4 },
00953 },
00954 .flags = PIX_FMT_RGB,
00955 },
00956 [AV_PIX_FMT_RGB555BE] = {
00957 .name = "rgb555be",
00958 .nb_components = 3,
00959 .log2_chroma_w = 0,
00960 .log2_chroma_h = 0,
00961 .comp = {
00962 { 0, 1, 0, 2, 4 },
00963 { 0, 1, 1, 5, 4 },
00964 { 0, 1, 1, 0, 4 },
00965 },
00966 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00967 },
00968 [AV_PIX_FMT_RGB555LE] = {
00969 .name = "rgb555le",
00970 .nb_components = 3,
00971 .log2_chroma_w = 0,
00972 .log2_chroma_h = 0,
00973 .comp = {
00974 { 0, 1, 2, 2, 4 },
00975 { 0, 1, 1, 5, 4 },
00976 { 0, 1, 1, 0, 4 },
00977 },
00978 .flags = PIX_FMT_RGB,
00979 },
00980 [AV_PIX_FMT_RGB444BE] = {
00981 .name = "rgb444be",
00982 .nb_components = 3,
00983 .log2_chroma_w = 0,
00984 .log2_chroma_h = 0,
00985 .comp = {
00986 { 0, 1, 0, 0, 3 },
00987 { 0, 1, 1, 4, 3 },
00988 { 0, 1, 1, 0, 3 },
00989 },
00990 .flags = PIX_FMT_BE | PIX_FMT_RGB,
00991 },
00992 [AV_PIX_FMT_RGB444LE] = {
00993 .name = "rgb444le",
00994 .nb_components = 3,
00995 .log2_chroma_w = 0,
00996 .log2_chroma_h = 0,
00997 .comp = {
00998 { 0, 1, 2, 0, 3 },
00999 { 0, 1, 1, 4, 3 },
01000 { 0, 1, 1, 0, 3 },
01001 },
01002 .flags = PIX_FMT_RGB,
01003 },
01004 [AV_PIX_FMT_BGR48BE] = {
01005 .name = "bgr48be",
01006 .nb_components = 3,
01007 .log2_chroma_w = 0,
01008 .log2_chroma_h = 0,
01009 .comp = {
01010 { 0, 5, 5, 0, 15 },
01011 { 0, 5, 3, 0, 15 },
01012 { 0, 5, 1, 0, 15 },
01013 },
01014 .flags = PIX_FMT_BE | PIX_FMT_RGB,
01015 },
01016 [AV_PIX_FMT_BGR48LE] = {
01017 .name = "bgr48le",
01018 .nb_components = 3,
01019 .log2_chroma_w = 0,
01020 .log2_chroma_h = 0,
01021 .comp = {
01022 { 0, 5, 5, 0, 15 },
01023 { 0, 5, 3, 0, 15 },
01024 { 0, 5, 1, 0, 15 },
01025 },
01026 .flags = PIX_FMT_RGB,
01027 },
01028 [AV_PIX_FMT_BGRA64BE] = {
01029 .name = "bgra64be",
01030 .nb_components= 4,
01031 .log2_chroma_w= 0,
01032 .log2_chroma_h= 0,
01033 .comp = {
01034 { 0, 7, 5, 0, 15 },
01035 { 0, 7, 3, 0, 15 },
01036 { 0, 7, 1, 0, 15 },
01037 { 0, 7, 7, 0, 15 },
01038 },
01039 .flags = PIX_FMT_BE | PIX_FMT_RGB | PIX_FMT_ALPHA,
01040 },
01041 [AV_PIX_FMT_BGRA64LE] = {
01042 .name = "bgra64le",
01043 .nb_components= 4,
01044 .log2_chroma_w= 0,
01045 .log2_chroma_h= 0,
01046 .comp = {
01047 { 0, 7, 5, 0, 15 },
01048 { 0, 7, 3, 0, 15 },
01049 { 0, 7, 1, 0, 15 },
01050 { 0, 7, 7, 0, 15 },
01051 },
01052 .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
01053 },
01054 [AV_PIX_FMT_BGR565BE] = {
01055 .name = "bgr565be",
01056 .nb_components = 3,
01057 .log2_chroma_w = 0,
01058 .log2_chroma_h = 0,
01059 .comp = {
01060 { 0, 1, 1, 0, 4 },
01061 { 0, 1, 1, 5, 5 },
01062 { 0, 1, 0, 3, 4 },
01063 },
01064 .flags = PIX_FMT_BE | PIX_FMT_RGB,
01065 },
01066 [AV_PIX_FMT_BGR565LE] = {
01067 .name = "bgr565le",
01068 .nb_components = 3,
01069 .log2_chroma_w = 0,
01070 .log2_chroma_h = 0,
01071 .comp = {
01072 { 0, 1, 1, 0, 4 },
01073 { 0, 1, 1, 5, 5 },
01074 { 0, 1, 2, 3, 4 },
01075 },
01076 .flags = PIX_FMT_RGB,
01077 },
01078 [AV_PIX_FMT_BGR555BE] = {
01079 .name = "bgr555be",
01080 .nb_components = 3,
01081 .log2_chroma_w = 0,
01082 .log2_chroma_h = 0,
01083 .comp = {
01084 { 0, 1, 1, 0, 4 },
01085 { 0, 1, 1, 5, 4 },
01086 { 0, 1, 0, 2, 4 },
01087 },
01088 .flags = PIX_FMT_BE | PIX_FMT_RGB,
01089 },
01090 [AV_PIX_FMT_BGR555LE] = {
01091 .name = "bgr555le",
01092 .nb_components = 3,
01093 .log2_chroma_w = 0,
01094 .log2_chroma_h = 0,
01095 .comp = {
01096 { 0, 1, 1, 0, 4 },
01097 { 0, 1, 1, 5, 4 },
01098 { 0, 1, 2, 2, 4 },
01099 },
01100 .flags = PIX_FMT_RGB,
01101 },
01102 [AV_PIX_FMT_BGR444BE] = {
01103 .name = "bgr444be",
01104 .nb_components = 3,
01105 .log2_chroma_w = 0,
01106 .log2_chroma_h = 0,
01107 .comp = {
01108 { 0, 1, 1, 0, 3 },
01109 { 0, 1, 1, 4, 3 },
01110 { 0, 1, 0, 0, 3 },
01111 },
01112 .flags = PIX_FMT_BE | PIX_FMT_RGB,
01113 },
01114 [AV_PIX_FMT_BGR444LE] = {
01115 .name = "bgr444le",
01116 .nb_components = 3,
01117 .log2_chroma_w = 0,
01118 .log2_chroma_h = 0,
01119 .comp = {
01120 { 0, 1, 1, 0, 3 },
01121 { 0, 1, 1, 4, 3 },
01122 { 0, 1, 2, 0, 3 },
01123 },
01124 .flags = PIX_FMT_RGB,
01125 },
01126 [AV_PIX_FMT_VAAPI_MOCO] = {
01127 .name = "vaapi_moco",
01128 .log2_chroma_w = 1,
01129 .log2_chroma_h = 1,
01130 .flags = PIX_FMT_HWACCEL,
01131 },
01132 [AV_PIX_FMT_VAAPI_IDCT] = {
01133 .name = "vaapi_idct",
01134 .log2_chroma_w = 1,
01135 .log2_chroma_h = 1,
01136 .flags = PIX_FMT_HWACCEL,
01137 },
01138 [AV_PIX_FMT_VAAPI_VLD] = {
01139 .name = "vaapi_vld",
01140 .log2_chroma_w = 1,
01141 .log2_chroma_h = 1,
01142 .flags = PIX_FMT_HWACCEL,
01143 },
01144 [AV_PIX_FMT_YUV420P9LE] = {
01145 .name = "yuv420p9le",
01146 .nb_components = 3,
01147 .log2_chroma_w = 1,
01148 .log2_chroma_h = 1,
01149 .comp = {
01150 { 0, 1, 1, 0, 8 },
01151 { 1, 1, 1, 0, 8 },
01152 { 2, 1, 1, 0, 8 },
01153 },
01154 .flags = PIX_FMT_PLANAR,
01155 },
01156 [AV_PIX_FMT_YUV420P9BE] = {
01157 .name = "yuv420p9be",
01158 .nb_components = 3,
01159 .log2_chroma_w = 1,
01160 .log2_chroma_h = 1,
01161 .comp = {
01162 { 0, 1, 1, 0, 8 },
01163 { 1, 1, 1, 0, 8 },
01164 { 2, 1, 1, 0, 8 },
01165 },
01166 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01167 },
01168 [AV_PIX_FMT_YUV420P10LE] = {
01169 .name = "yuv420p10le",
01170 .nb_components = 3,
01171 .log2_chroma_w = 1,
01172 .log2_chroma_h = 1,
01173 .comp = {
01174 { 0, 1, 1, 0, 9 },
01175 { 1, 1, 1, 0, 9 },
01176 { 2, 1, 1, 0, 9 },
01177 },
01178 .flags = PIX_FMT_PLANAR,
01179 },
01180 [AV_PIX_FMT_YUV420P10BE] = {
01181 .name = "yuv420p10be",
01182 .nb_components = 3,
01183 .log2_chroma_w = 1,
01184 .log2_chroma_h = 1,
01185 .comp = {
01186 { 0, 1, 1, 0, 9 },
01187 { 1, 1, 1, 0, 9 },
01188 { 2, 1, 1, 0, 9 },
01189 },
01190 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01191 },
01192 [AV_PIX_FMT_YUV420P12LE] = {
01193 .name = "yuv420p12le",
01194 .nb_components = 3,
01195 .log2_chroma_w = 1,
01196 .log2_chroma_h = 1,
01197 .comp = {
01198 { 0, 1, 1, 0, 11 },
01199 { 1, 1, 1, 0, 11 },
01200 { 2, 1, 1, 0, 11 },
01201 },
01202 .flags = PIX_FMT_PLANAR,
01203 },
01204 [AV_PIX_FMT_YUV420P12BE] = {
01205 .name = "yuv420p12be",
01206 .nb_components = 3,
01207 .log2_chroma_w = 1,
01208 .log2_chroma_h = 1,
01209 .comp = {
01210 { 0, 1, 1, 0, 11 },
01211 { 1, 1, 1, 0, 11 },
01212 { 2, 1, 1, 0, 11 },
01213 },
01214 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01215 },
01216 [AV_PIX_FMT_YUV420P14LE] = {
01217 .name = "yuv420p14le",
01218 .nb_components = 3,
01219 .log2_chroma_w = 1,
01220 .log2_chroma_h = 1,
01221 .comp = {
01222 { 0, 1, 1, 0, 13 },
01223 { 1, 1, 1, 0, 13 },
01224 { 2, 1, 1, 0, 13 },
01225 },
01226 .flags = PIX_FMT_PLANAR,
01227 },
01228 [AV_PIX_FMT_YUV420P14BE] = {
01229 .name = "yuv420p14be",
01230 .nb_components = 3,
01231 .log2_chroma_w = 1,
01232 .log2_chroma_h = 1,
01233 .comp = {
01234 { 0, 1, 1, 0, 13 },
01235 { 1, 1, 1, 0, 13 },
01236 { 2, 1, 1, 0, 13 },
01237 },
01238 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01239 },
01240 [AV_PIX_FMT_YUV420P16LE] = {
01241 .name = "yuv420p16le",
01242 .nb_components = 3,
01243 .log2_chroma_w = 1,
01244 .log2_chroma_h = 1,
01245 .comp = {
01246 { 0, 1, 1, 0, 15 },
01247 { 1, 1, 1, 0, 15 },
01248 { 2, 1, 1, 0, 15 },
01249 },
01250 .flags = PIX_FMT_PLANAR,
01251 },
01252 [AV_PIX_FMT_YUV420P16BE] = {
01253 .name = "yuv420p16be",
01254 .nb_components = 3,
01255 .log2_chroma_w = 1,
01256 .log2_chroma_h = 1,
01257 .comp = {
01258 { 0, 1, 1, 0, 15 },
01259 { 1, 1, 1, 0, 15 },
01260 { 2, 1, 1, 0, 15 },
01261 },
01262 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01263 },
01264 [AV_PIX_FMT_YUV422P9LE] = {
01265 .name = "yuv422p9le",
01266 .nb_components = 3,
01267 .log2_chroma_w = 1,
01268 .log2_chroma_h = 0,
01269 .comp = {
01270 { 0, 1, 1, 0, 8 },
01271 { 1, 1, 1, 0, 8 },
01272 { 2, 1, 1, 0, 8 },
01273 },
01274 .flags = PIX_FMT_PLANAR,
01275 },
01276 [AV_PIX_FMT_YUV422P9BE] = {
01277 .name = "yuv422p9be",
01278 .nb_components = 3,
01279 .log2_chroma_w = 1,
01280 .log2_chroma_h = 0,
01281 .comp = {
01282 { 0, 1, 1, 0, 8 },
01283 { 1, 1, 1, 0, 8 },
01284 { 2, 1, 1, 0, 8 },
01285 },
01286 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01287 },
01288 [AV_PIX_FMT_YUV422P10LE] = {
01289 .name = "yuv422p10le",
01290 .nb_components = 3,
01291 .log2_chroma_w = 1,
01292 .log2_chroma_h = 0,
01293 .comp = {
01294 { 0, 1, 1, 0, 9 },
01295 { 1, 1, 1, 0, 9 },
01296 { 2, 1, 1, 0, 9 },
01297 },
01298 .flags = PIX_FMT_PLANAR,
01299 },
01300 [AV_PIX_FMT_YUV422P10BE] = {
01301 .name = "yuv422p10be",
01302 .nb_components = 3,
01303 .log2_chroma_w = 1,
01304 .log2_chroma_h = 0,
01305 .comp = {
01306 { 0, 1, 1, 0, 9 },
01307 { 1, 1, 1, 0, 9 },
01308 { 2, 1, 1, 0, 9 },
01309 },
01310 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01311 },
01312 [AV_PIX_FMT_YUV422P12LE] = {
01313 .name = "yuv422p12le",
01314 .nb_components = 3,
01315 .log2_chroma_w = 1,
01316 .log2_chroma_h = 0,
01317 .comp = {
01318 { 0, 1, 1, 0, 11 },
01319 { 1, 1, 1, 0, 11 },
01320 { 2, 1, 1, 0, 11 },
01321 },
01322 .flags = PIX_FMT_PLANAR,
01323 },
01324 [AV_PIX_FMT_YUV422P12BE] = {
01325 .name = "yuv422p12be",
01326 .nb_components = 3,
01327 .log2_chroma_w = 1,
01328 .log2_chroma_h = 0,
01329 .comp = {
01330 { 0, 1, 1, 0, 11 },
01331 { 1, 1, 1, 0, 11 },
01332 { 2, 1, 1, 0, 11 },
01333 },
01334 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01335 },
01336 [AV_PIX_FMT_YUV422P14LE] = {
01337 .name = "yuv422p14le",
01338 .nb_components = 3,
01339 .log2_chroma_w = 1,
01340 .log2_chroma_h = 0,
01341 .comp = {
01342 { 0, 1, 1, 0, 13 },
01343 { 1, 1, 1, 0, 13 },
01344 { 2, 1, 1, 0, 13 },
01345 },
01346 .flags = PIX_FMT_PLANAR,
01347 },
01348 [AV_PIX_FMT_YUV422P14BE] = {
01349 .name = "yuv422p14be",
01350 .nb_components = 3,
01351 .log2_chroma_w = 1,
01352 .log2_chroma_h = 0,
01353 .comp = {
01354 { 0, 1, 1, 0, 13 },
01355 { 1, 1, 1, 0, 13 },
01356 { 2, 1, 1, 0, 13 },
01357 },
01358 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01359 },
01360 [AV_PIX_FMT_YUV422P16LE] = {
01361 .name = "yuv422p16le",
01362 .nb_components = 3,
01363 .log2_chroma_w = 1,
01364 .log2_chroma_h = 0,
01365 .comp = {
01366 { 0, 1, 1, 0, 15 },
01367 { 1, 1, 1, 0, 15 },
01368 { 2, 1, 1, 0, 15 },
01369 },
01370 .flags = PIX_FMT_PLANAR,
01371 },
01372 [AV_PIX_FMT_YUV422P16BE] = {
01373 .name = "yuv422p16be",
01374 .nb_components = 3,
01375 .log2_chroma_w = 1,
01376 .log2_chroma_h = 0,
01377 .comp = {
01378 { 0, 1, 1, 0, 15 },
01379 { 1, 1, 1, 0, 15 },
01380 { 2, 1, 1, 0, 15 },
01381 },
01382 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01383 },
01384 [AV_PIX_FMT_YUV444P16LE] = {
01385 .name = "yuv444p16le",
01386 .nb_components = 3,
01387 .log2_chroma_w = 0,
01388 .log2_chroma_h = 0,
01389 .comp = {
01390 { 0, 1, 1, 0, 15 },
01391 { 1, 1, 1, 0, 15 },
01392 { 2, 1, 1, 0, 15 },
01393 },
01394 .flags = PIX_FMT_PLANAR,
01395 },
01396 [AV_PIX_FMT_YUV444P16BE] = {
01397 .name = "yuv444p16be",
01398 .nb_components = 3,
01399 .log2_chroma_w = 0,
01400 .log2_chroma_h = 0,
01401 .comp = {
01402 { 0, 1, 1, 0, 15 },
01403 { 1, 1, 1, 0, 15 },
01404 { 2, 1, 1, 0, 15 },
01405 },
01406 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01407 },
01408 [AV_PIX_FMT_YUV444P10LE] = {
01409 .name = "yuv444p10le",
01410 .nb_components = 3,
01411 .log2_chroma_w = 0,
01412 .log2_chroma_h = 0,
01413 .comp = {
01414 { 0, 1, 1, 0, 9 },
01415 { 1, 1, 1, 0, 9 },
01416 { 2, 1, 1, 0, 9 },
01417 },
01418 .flags = PIX_FMT_PLANAR,
01419 },
01420 [AV_PIX_FMT_YUV444P10BE] = {
01421 .name = "yuv444p10be",
01422 .nb_components = 3,
01423 .log2_chroma_w = 0,
01424 .log2_chroma_h = 0,
01425 .comp = {
01426 { 0, 1, 1, 0, 9 },
01427 { 1, 1, 1, 0, 9 },
01428 { 2, 1, 1, 0, 9 },
01429 },
01430 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01431 },
01432 [AV_PIX_FMT_YUV444P9LE] = {
01433 .name = "yuv444p9le",
01434 .nb_components = 3,
01435 .log2_chroma_w = 0,
01436 .log2_chroma_h = 0,
01437 .comp = {
01438 { 0, 1, 1, 0, 8 },
01439 { 1, 1, 1, 0, 8 },
01440 { 2, 1, 1, 0, 8 },
01441 },
01442 .flags = PIX_FMT_PLANAR,
01443 },
01444 [AV_PIX_FMT_YUV444P9BE] = {
01445 .name = "yuv444p9be",
01446 .nb_components = 3,
01447 .log2_chroma_w = 0,
01448 .log2_chroma_h = 0,
01449 .comp = {
01450 { 0, 1, 1, 0, 8 },
01451 { 1, 1, 1, 0, 8 },
01452 { 2, 1, 1, 0, 8 },
01453 },
01454 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01455 },
01456 [AV_PIX_FMT_YUV444P12LE] = {
01457 .name = "yuv444p12le",
01458 .nb_components = 3,
01459 .log2_chroma_w = 0,
01460 .log2_chroma_h = 0,
01461 .comp = {
01462 { 0, 1, 1, 0, 11 },
01463 { 1, 1, 1, 0, 11 },
01464 { 2, 1, 1, 0, 11 },
01465 },
01466 .flags = PIX_FMT_PLANAR,
01467 },
01468 [AV_PIX_FMT_YUV444P12BE] = {
01469 .name = "yuv444p12be",
01470 .nb_components = 3,
01471 .log2_chroma_w = 0,
01472 .log2_chroma_h = 0,
01473 .comp = {
01474 { 0, 1, 1, 0, 11 },
01475 { 1, 1, 1, 0, 11 },
01476 { 2, 1, 1, 0, 11 },
01477 },
01478 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01479 },
01480 [AV_PIX_FMT_YUV444P14LE] = {
01481 .name = "yuv444p14le",
01482 .nb_components = 3,
01483 .log2_chroma_w = 0,
01484 .log2_chroma_h = 0,
01485 .comp = {
01486 { 0, 1, 1, 0, 13 },
01487 { 1, 1, 1, 0, 13 },
01488 { 2, 1, 1, 0, 13 },
01489 },
01490 .flags = PIX_FMT_PLANAR,
01491 },
01492 [AV_PIX_FMT_YUV444P14BE] = {
01493 .name = "yuv444p14be",
01494 .nb_components = 3,
01495 .log2_chroma_w = 0,
01496 .log2_chroma_h = 0,
01497 .comp = {
01498 { 0, 1, 1, 0, 13 },
01499 { 1, 1, 1, 0, 13 },
01500 { 2, 1, 1, 0, 13 },
01501 },
01502 .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
01503 },
01504 [AV_PIX_FMT_DXVA2_VLD] = {
01505 .name = "dxva2_vld",
01506 .log2_chroma_w = 1,
01507 .log2_chroma_h = 1,
01508 .flags = PIX_FMT_HWACCEL,
01509 },
01510 [AV_PIX_FMT_VDA_VLD] = {
01511 .name = "vda_vld",
01512 .log2_chroma_w = 1,
01513 .log2_chroma_h = 1,
01514 .flags = PIX_FMT_HWACCEL,
01515 },
01516 [AV_PIX_FMT_GRAY8A] = {
01517 .name = "gray8a",
01518 .nb_components = 2,
01519 .comp = {
01520 { 0, 1, 1, 0, 7 },
01521 { 0, 1, 2, 0, 7 },
01522 },
01523 .flags = PIX_FMT_ALPHA,
01524 },
01525 [AV_PIX_FMT_GBRP] = {
01526 .name = "gbrp",
01527 .nb_components = 3,
01528 .log2_chroma_w = 0,
01529 .log2_chroma_h = 0,
01530 .comp = {
01531 { 2, 0, 1, 0, 7 },
01532 { 0, 0, 1, 0, 7 },
01533 { 1, 0, 1, 0, 7 },
01534 },
01535 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01536 },
01537 [AV_PIX_FMT_GBRP9LE] = {
01538 .name = "gbrp9le",
01539 .nb_components = 3,
01540 .log2_chroma_w = 0,
01541 .log2_chroma_h = 0,
01542 .comp = {
01543 { 2, 1, 1, 0, 8 },
01544 { 0, 1, 1, 0, 8 },
01545 { 1, 1, 1, 0, 8 },
01546 },
01547 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01548 },
01549 [AV_PIX_FMT_GBRP9BE] = {
01550 .name = "gbrp9be",
01551 .nb_components = 3,
01552 .log2_chroma_w = 0,
01553 .log2_chroma_h = 0,
01554 .comp = {
01555 { 2, 1, 1, 0, 8 },
01556 { 0, 1, 1, 0, 8 },
01557 { 1, 1, 1, 0, 8 },
01558 },
01559 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01560 },
01561 [AV_PIX_FMT_GBRP10LE] = {
01562 .name = "gbrp10le",
01563 .nb_components = 3,
01564 .log2_chroma_w = 0,
01565 .log2_chroma_h = 0,
01566 .comp = {
01567 { 2, 1, 1, 0, 9 },
01568 { 0, 1, 1, 0, 9 },
01569 { 1, 1, 1, 0, 9 },
01570 },
01571 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01572 },
01573 [AV_PIX_FMT_GBRP10BE] = {
01574 .name = "gbrp10be",
01575 .nb_components = 3,
01576 .log2_chroma_w = 0,
01577 .log2_chroma_h = 0,
01578 .comp = {
01579 { 2, 1, 1, 0, 9 },
01580 { 0, 1, 1, 0, 9 },
01581 { 1, 1, 1, 0, 9 },
01582 },
01583 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01584 },
01585 [AV_PIX_FMT_GBRP12LE] = {
01586 .name = "gbrp12le",
01587 .nb_components = 3,
01588 .log2_chroma_w = 0,
01589 .log2_chroma_h = 0,
01590 .comp = {
01591 { 2, 1, 1, 0, 11 },
01592 { 0, 1, 1, 0, 11 },
01593 { 1, 1, 1, 0, 11 },
01594 },
01595 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01596 },
01597 [AV_PIX_FMT_GBRP12BE] = {
01598 .name = "gbrp12be",
01599 .nb_components = 3,
01600 .log2_chroma_w = 0,
01601 .log2_chroma_h = 0,
01602 .comp = {
01603 { 2, 1, 1, 0, 11 },
01604 { 0, 1, 1, 0, 11 },
01605 { 1, 1, 1, 0, 11 },
01606 },
01607 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01608 },
01609 [AV_PIX_FMT_GBRP14LE] = {
01610 .name = "gbrp14le",
01611 .nb_components = 3,
01612 .log2_chroma_w = 0,
01613 .log2_chroma_h = 0,
01614 .comp = {
01615 { 2, 1, 1, 0, 13 },
01616 { 0, 1, 1, 0, 13 },
01617 { 1, 1, 1, 0, 13 },
01618 },
01619 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01620 },
01621 [AV_PIX_FMT_GBRP14BE] = {
01622 .name = "gbrp14be",
01623 .nb_components = 3,
01624 .log2_chroma_w = 0,
01625 .log2_chroma_h = 0,
01626 .comp = {
01627 { 2, 1, 1, 0, 13 },
01628 { 0, 1, 1, 0, 13 },
01629 { 1, 1, 1, 0, 13 },
01630 },
01631 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01632 },
01633 [AV_PIX_FMT_GBRP16LE] = {
01634 .name = "gbrp16le",
01635 .nb_components = 3,
01636 .log2_chroma_w = 0,
01637 .log2_chroma_h = 0,
01638 .comp = {
01639 { 2, 1, 1, 0, 15 },
01640 { 0, 1, 1, 0, 15 },
01641 { 1, 1, 1, 0, 15 },
01642 },
01643 .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
01644 },
01645 [AV_PIX_FMT_GBRP16BE] = {
01646 .name = "gbrp16be",
01647 .nb_components = 3,
01648 .log2_chroma_w = 0,
01649 .log2_chroma_h = 0,
01650 .comp = {
01651 { 2, 1, 1, 0, 15 },
01652 { 0, 1, 1, 0, 15 },
01653 { 1, 1, 1, 0, 15 },
01654 },
01655 .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
01656 },
01657 };
01658
01659 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
01660 {
01661 enum AVPixelFormat pix_fmt;
01662
01663 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
01664 if (av_pix_fmt_descriptors[pix_fmt].name &&
01665 !strcmp(av_pix_fmt_descriptors[pix_fmt].name, name))
01666 return pix_fmt;
01667
01668 return AV_PIX_FMT_NONE;
01669 }
01670
01671 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
01672 {
01673 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
01674 av_pix_fmt_descriptors[pix_fmt].name : NULL;
01675 }
01676
01677 #if HAVE_BIGENDIAN
01678 # define X_NE(be, le) be
01679 #else
01680 # define X_NE(be, le) le
01681 #endif
01682
01683 enum AVPixelFormat av_get_pix_fmt(const char *name)
01684 {
01685 enum AVPixelFormat pix_fmt;
01686
01687 if (!strcmp(name, "rgb32"))
01688 name = X_NE("argb", "bgra");
01689 else if (!strcmp(name, "bgr32"))
01690 name = X_NE("abgr", "rgba");
01691
01692 pix_fmt = get_pix_fmt_internal(name);
01693 if (pix_fmt == AV_PIX_FMT_NONE) {
01694 char name2[32];
01695
01696 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
01697 pix_fmt = get_pix_fmt_internal(name2);
01698 }
01699 return pix_fmt;
01700 }
01701
01702 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
01703 {
01704 int c, bits = 0;
01705 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
01706
01707 for (c = 0; c < pixdesc->nb_components; c++) {
01708 int s = c == 1 || c == 2 ? 0 : log2_pixels;
01709 bits += (pixdesc->comp[c].depth_minus1 + 1) << s;
01710 }
01711
01712 return bits >> log2_pixels;
01713 }
01714
01715 int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
01716 {
01717 int c, bits = 0;
01718 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
01719 int steps[4] = {0};
01720
01721 for (c = 0; c < pixdesc->nb_components; c++) {
01722 AVComponentDescriptor *comp = &pixdesc->comp[c];
01723 int s = c == 1 || c == 2 ? 0 : log2_pixels;
01724 steps[comp->plane] = (comp->step_minus1 + 1) << s;
01725 }
01726 for (c = 0; c < 4; c++)
01727 bits += steps[c];
01728
01729 if(!(pixdesc->flags & PIX_FMT_BITSTREAM))
01730 bits *= 8;
01731
01732 return bits >> log2_pixels;
01733 }
01734
01735 char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt)
01736 {
01737
01738 if (pix_fmt < 0) {
01739 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
01740 } else {
01741 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
01742 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
01743 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
01744 }
01745
01746 return buf;
01747 }
01748
01749 const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
01750 {
01751 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
01752 return NULL;
01753 return &av_pix_fmt_descriptors[pix_fmt];
01754 }
01755
01756 const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
01757 {
01758 if (!prev)
01759 return &av_pix_fmt_descriptors[0];
01760 if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1)
01761 return prev + 1;
01762 return NULL;
01763 }
01764
01765 enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
01766 {
01767 if (desc < av_pix_fmt_descriptors ||
01768 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
01769 return AV_PIX_FMT_NONE;
01770
01771 return desc - av_pix_fmt_descriptors;
01772 }
01773
01774 int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
01775 int *h_shift, int *v_shift)
01776 {
01777 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
01778 if (!desc)
01779 return AVERROR(ENOSYS);
01780 *h_shift = desc->log2_chroma_w;
01781 *v_shift = desc->log2_chroma_h;
01782
01783 return 0;
01784 }