Add missing rawvideo pixel formats to codec tags mappings for nut.
[libav.git] / libavcodec / raw.c
CommitLineData
e8750b00
FR
1/*
2 * Raw Video Codec
406792e7 3 * Copyright (c) 2001 Fabrice Bellard
e8750b00 4 *
b78e7197
DB
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
e8750b00
FR
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
b78e7197 10 * version 2.1 of the License, or (at your option) any later version.
e8750b00 11 *
b78e7197 12 * FFmpeg is distributed in the hope that it will be useful,
e8750b00
FR
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
b78e7197 18 * License along with FFmpeg; if not, write to the Free Software
5509bffa 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
e8750b00 20 */
115329f1 21
e8750b00 22/**
ba87f080 23 * @file
e8750b00
FR
24 * Raw Video Codec
25 */
115329f1 26
e8750b00 27#include "avcodec.h"
3a763f0f 28#include "raw.h"
e8750b00 29
3a763f0f 30const PixelFormatTag ff_raw_pixelFormatTags[] = {
63167088
RS
31 { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
32 { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
0b23d689 33 { PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') },
63167088 34 { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') },
71b0654c 35 { PIX_FMT_YUV410P, MKTAG('Y', 'V', 'U', '9') },
63167088
RS
36 { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') },
37 { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') },
9853bbb2 38 { PIX_FMT_YUV422P, MKTAG('P', '4', '2', '2') },
934edecd
SS
39 /* yuvjXXX formats are deprecated hacks specific to libav*,
40 they are identical to yuvXXX */
41 { PIX_FMT_YUVJ420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
42 { PIX_FMT_YUVJ420P, MKTAG('I', 'Y', 'U', 'V') },
43 { PIX_FMT_YUVJ420P, MKTAG('Y', 'V', '1', '2') },
44 { PIX_FMT_YUVJ422P, MKTAG('Y', '4', '2', 'B') },
45 { PIX_FMT_YUVJ422P, MKTAG('P', '4', '2', '2') },
63167088
RS
46 { PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') },
47 { PIX_FMT_GRAY8, MKTAG(' ', ' ', 'Y', '8') },
48
49
71e445fc
DB
50 { PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */
51 { PIX_FMT_YUYV422, MKTAG('Y', '4', '2', '2') },
9853bbb2 52 { PIX_FMT_YUYV422, MKTAG('V', '4', '2', '2') },
e47ca4f7 53 { PIX_FMT_YUYV422, MKTAG('V', 'Y', 'U', 'Y') },
9853bbb2 54 { PIX_FMT_YUYV422, MKTAG('Y', 'U', 'N', 'V') },
3dc10d47 55 { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') },
32bbb99d 56 { PIX_FMT_UYVY422, MKTAG('H', 'D', 'Y', 'C') },
9853bbb2
BL
57 { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'V') },
58 { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'Y') },
59 { PIX_FMT_UYVY422, MKTAG('u', 'y', 'v', '1') },
60 { PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', '1') },
c78dfcda 61 { PIX_FMT_UYVY422, MKTAG('A', 'V', 'R', 'n') }, /* Avid AVI Codec 1:1 */
a0ae3e41 62 { PIX_FMT_UYVY422, MKTAG('A', 'V', '1', 'x') }, /* Avid 1:1x */
59ea69ef 63 { PIX_FMT_UYVY422, MKTAG('A', 'V', 'u', 'p') },
8be7ac98 64 { PIX_FMT_UYVY422, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */
b43f432c 65 { PIX_FMT_UYYVYY411, MKTAG('Y', '4', '1', '1') },
63167088 66 { PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') },
73762de1
SS
67 { PIX_FMT_NV12, MKTAG('N', 'V', '1', '2') },
68 { PIX_FMT_NV21, MKTAG('N', 'V', '2', '1') },
658e7576
SS
69
70 /* nut */
e5747706
SS
71 { PIX_FMT_RGB555LE, MKTAG('R', 'G', 'B', 15) },
72 { PIX_FMT_BGR555LE, MKTAG('B', 'G', 'R', 15) },
73 { PIX_FMT_RGB565LE, MKTAG('R', 'G', 'B', 16) },
74 { PIX_FMT_BGR565LE, MKTAG('B', 'G', 'R', 16) },
43451ec2
SS
75 { PIX_FMT_RGB555BE, MKTAG(15 , 'B', 'G', 'R') },
76 { PIX_FMT_BGR555BE, MKTAG(15 , 'R', 'G', 'B') },
77 { PIX_FMT_RGB565BE, MKTAG(16 , 'B', 'G', 'R') },
78 { PIX_FMT_BGR565BE, MKTAG(16 , 'R', 'G', 'B') },
79 { PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') },
80 { PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') },
81 { PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') },
82 { PIX_FMT_ARGB, MKTAG('A', 'R', 'G', 'B') },
83 { PIX_FMT_RGB24, MKTAG('R', 'G', 'B', 24 ) },
84 { PIX_FMT_BGR24, MKTAG('B', 'G', 'R', 24 ) },
ed395eb4
SS
85 { PIX_FMT_YUV411P, MKTAG('4', '1', '1', 'P') },
86 { PIX_FMT_YUV422P, MKTAG('4', '2', '2', 'P') },
87 { PIX_FMT_YUVJ422P, MKTAG('4', '2', '2', 'P') },
88 { PIX_FMT_YUV440P, MKTAG('4', '4', '0', 'P') },
89 { PIX_FMT_YUVJ440P, MKTAG('4', '4', '0', 'P') },
90 { PIX_FMT_YUV444P, MKTAG('4', '4', '4', 'P') },
91 { PIX_FMT_YUVJ444P, MKTAG('4', '4', '4', 'P') },
92 { PIX_FMT_MONOWHITE,MKTAG('B', '1', 'W', '0') },
93 { PIX_FMT_MONOBLACK,MKTAG('B', 'O', 'W', '1') },
94 { PIX_FMT_BGR8, MKTAG('B', 'G', 'R', 8 ) },
95 { PIX_FMT_RGB8, MKTAG('R', 'G', 'B', 8 ) },
96 { PIX_FMT_BGR4, MKTAG('B', 'G', 'R', 4 ) },
97 { PIX_FMT_RGB4, MKTAG('R', 'G', 'B', 4 ) },
98 { PIX_FMT_RGB48LE, MKTAG('R', 'G', 'B', 48 ) },
99 { PIX_FMT_RGB48BE, MKTAG( 48, 'R', 'G', 'B') },
63167088 100
ed70a509
BC
101 /* quicktime */
102 { PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') },
a4be782c 103 { PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', 'y') },
b0c59da2 104 { PIX_FMT_UYVY422, MKTAG('A', 'V', 'U', 'I') }, /* FIXME merge both fields */
3dd2f87e 105 { PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
42022e03 106 { PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
02a5ef53 107 { PIX_FMT_PAL8, MKTAG('W', 'R', 'A', 'W') },
ed70a509 108
658e7576
SS
109 /* special */
110 { PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */
111
95240bf3 112 { PIX_FMT_NONE, 0 },
e8750b00
FR
113};
114
d07730dd 115unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat fmt)
63167088 116{
3a763f0f 117 const PixelFormatTag * tags = ff_raw_pixelFormatTags;
63167088
RS
118 while (tags->pix_fmt >= 0) {
119 if (tags->pix_fmt == fmt)
bb270c08
DB
120 return tags->fourcc;
121 tags++;
63167088
RS
122 }
123 return 0;
124}