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
22 #include "libavutil/pixfmt.h"
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
] = {
229 .flags
= PIX_FMT_BITSTREAM
,
231 [PIX_FMT_BGR4_BYTE
] = {
263 .flags
= PIX_FMT_BITSTREAM
,
265 [PIX_FMT_RGB4_BYTE
] = {
346 [PIX_FMT_GRAY16BE
] = {
352 {0,1,1,0,15}, /* Y */
356 [PIX_FMT_GRAY16LE
] = {
362 {0,1,1,0,15}, /* Y */
365 [PIX_FMT_YUV440P
] = {
376 [PIX_FMT_YUVJ440P
] = {
387 [PIX_FMT_YUVA420P
] = {
399 [PIX_FMT_RGB48BE
] = {
405 {0,5,1,0,15}, /* R */
406 {0,5,3,0,15}, /* G */
407 {0,5,5,0,15}, /* B */
411 [PIX_FMT_RGB48LE
] = {
417 {0,5,1,0,15}, /* R */
418 {0,5,3,0,15}, /* G */
419 {0,5,5,0,15}, /* B */
422 [PIX_FMT_RGB565BE
] = {
434 [PIX_FMT_RGB565LE
] = {
445 [PIX_FMT_RGB555BE
] = {
457 [PIX_FMT_RGB555LE
] = {
468 [PIX_FMT_BGR565BE
] = {
480 [PIX_FMT_BGR565LE
] = {
491 [PIX_FMT_BGR555BE
] = {
503 [PIX_FMT_BGR555LE
] = {
514 [PIX_FMT_YUV420PLE
] = {
520 {0,1,1,0,15}, /* Y */
521 {1,1,1,0,15}, /* U */
522 {2,1,1,0,15}, /* V */
525 [PIX_FMT_YUV420PBE
] = {
531 {0,1,1,0,15}, /* Y */
532 {1,1,1,0,15}, /* U */
533 {2,1,1,0,15}, /* V */
537 [PIX_FMT_YUV422PLE
] = {
543 {0,1,1,0,15}, /* Y */
544 {1,1,1,0,15}, /* U */
545 {2,1,1,0,15}, /* V */
548 [PIX_FMT_YUV422PBE
] = {
554 {0,1,1,0,15}, /* Y */
555 {1,1,1,0,15}, /* U */
556 {2,1,1,0,15}, /* V */
560 [PIX_FMT_YUV444PLE
] = {
566 {0,1,1,0,15}, /* Y */
567 {1,1,1,0,15}, /* U */
568 {2,1,1,0,15}, /* V */
571 [PIX_FMT_YUV444PBE
] = {
577 {0,1,1,0,15}, /* Y */
578 {1,1,1,0,15}, /* U */
579 {2,1,1,0,15}, /* V */
585 int av_get_bits_per_pixel(const AVPixFmtDescriptor
*pixdesc
)
588 int log2_pixels
= pixdesc
->log2_chroma_w
+ pixdesc
->log2_chroma_h
;
590 for (c
= 0; c
< pixdesc
->nb_channels
; c
++) {
591 int s
= c
==1 || c
==2 ? 0 : log2_pixels
;
592 bits
+= (pixdesc
->comp
[c
].depth_minus1
+1) << s
;
595 return bits
>> log2_pixels
;