2 * pixel format descriptor
3 * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
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.
12 * FFmpeg is distributed in the hope that it will be useful,
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.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
103 [PIX_FMT_YUV411P] = {
123 [PIX_FMT_MONOWHITE] = {
131 .flags = PIX_FMT_BITSTREAM,
133 [PIX_FMT_MONOBLACK] = {
141 .flags = PIX_FMT_BITSTREAM,
151 .flags = PIX_FMT_PAL,
153 [PIX_FMT_YUVJ420P] = {
164 [PIX_FMT_YUVJ422P] = {
175 [PIX_FMT_YUVJ444P] = {
186 [PIX_FMT_UYVY422] = {
197 [PIX_FMT_UYYVYY411] = {
218 .flags = PIX_FMT_PAL,
230 .flags = PIX_FMT_BITSTREAM,
232 [PIX_FMT_BGR4_BYTE] = {
242 .flags = PIX_FMT_PAL,
254 .flags = PIX_FMT_PAL,
266 .flags = PIX_FMT_BITSTREAM,
268 [PIX_FMT_RGB4_BYTE] = {
278 .flags = PIX_FMT_PAL,
350 [PIX_FMT_GRAY16BE] = {
356 {0,1,1,0,15}, /* Y */
360 [PIX_FMT_GRAY16LE] = {
366 {0,1,1,0,15}, /* Y */
369 [PIX_FMT_YUV440P] = {
380 [PIX_FMT_YUVJ440P] = {
391 [PIX_FMT_YUVA420P] = {
403 [PIX_FMT_RGB48BE] = {
409 {0,5,1,0,15}, /* R */
410 {0,5,3,0,15}, /* G */
411 {0,5,5,0,15}, /* B */
415 [PIX_FMT_RGB48LE] = {
421 {0,5,1,0,15}, /* R */
422 {0,5,3,0,15}, /* G */
423 {0,5,5,0,15}, /* B */
426 [PIX_FMT_RGB565BE] = {
438 [PIX_FMT_RGB565LE] = {
449 [PIX_FMT_RGB555BE] = {
461 [PIX_FMT_RGB555LE] = {
472 [PIX_FMT_BGR565BE] = {
484 [PIX_FMT_BGR565LE] = {
495 [PIX_FMT_BGR555BE] = {
507 [PIX_FMT_BGR555LE] = {
518 [PIX_FMT_YUV420P16LE] = {
519 .name = "yuv420p16le",
524 {0,1,1,0,15}, /* Y */
525 {1,1,1,0,15}, /* U */
526 {2,1,1,0,15}, /* V */
529 [PIX_FMT_YUV420P16BE] = {
530 .name = "yuv420p16be",
535 {0,1,1,0,15}, /* Y */
536 {1,1,1,0,15}, /* U */
537 {2,1,1,0,15}, /* V */
541 [PIX_FMT_YUV422P16LE] = {
542 .name = "yuv422p16le",
547 {0,1,1,0,15}, /* Y */
548 {1,1,1,0,15}, /* U */
549 {2,1,1,0,15}, /* V */
552 [PIX_FMT_YUV422P16BE] = {
553 .name = "yuv422p16be",
558 {0,1,1,0,15}, /* Y */
559 {1,1,1,0,15}, /* U */
560 {2,1,1,0,15}, /* V */
564 [PIX_FMT_YUV444P16LE] = {
565 .name = "yuv444p16le",
570 {0,1,1,0,15}, /* Y */
571 {1,1,1,0,15}, /* U */
572 {2,1,1,0,15}, /* V */
575 [PIX_FMT_YUV444P16BE] = {
576 .name = "yuv444p16be",
581 {0,1,1,0,15}, /* Y */
582 {1,1,1,0,15}, /* U */
583 {2,1,1,0,15}, /* V */
589 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
592 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
594 for (c = 0; c < pixdesc->nb_channels; c++) {
595 int s = c==1 || c==2 ? 0 : log2_pixels;
596 bits += (pixdesc->comp[c].depth_minus1+1) << s;
599 return bits >> log2_pixels;