FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/raw.c
Date: 2022-11-26 13:19:19
Exec Total Coverage
Lines: 25 27 92.6%
Branches: 11 12 91.7%

Line Branch Exec Source
1 /*
2 * Raw Video Codec
3 * Copyright (c) 2001 Fabrice Bellard
4 *
5 * This file is part of FFmpeg.
6 *
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.
11 *
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.
16 *
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
20 */
21
22 /**
23 * @file
24 * Raw Video Codec
25 */
26
27 #include "libavutil/macros.h"
28 #include "avcodec.h"
29 #include "raw.h"
30
31 static const PixelFormatTag raw_pix_fmt_tags[] = {
32 { AV_PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
33 { AV_PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
34 { AV_PIX_FMT_YUV420P, MKTAG('y', 'v', '1', '2') },
35 { AV_PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') },
36 { AV_PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') },
37 { AV_PIX_FMT_YUV410P, MKTAG('Y', 'V', 'U', '9') },
38 { AV_PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') },
39 { AV_PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') },
40 { AV_PIX_FMT_YUV422P, MKTAG('P', '4', '2', '2') },
41 { AV_PIX_FMT_YUV422P, MKTAG('Y', 'V', '1', '6') },
42 /* yuvjXXX formats are deprecated hacks specific to libav*,
43 they are identical to yuvXXX */
44 { AV_PIX_FMT_YUVJ420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
45 { AV_PIX_FMT_YUVJ420P, MKTAG('I', 'Y', 'U', 'V') },
46 { AV_PIX_FMT_YUVJ420P, MKTAG('Y', 'V', '1', '2') },
47 { AV_PIX_FMT_YUVJ422P, MKTAG('Y', '4', '2', 'B') },
48 { AV_PIX_FMT_YUVJ422P, MKTAG('P', '4', '2', '2') },
49 { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') },
50 { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', ' ', ' ') },
51
52 { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */
53 { AV_PIX_FMT_YUYV422, MKTAG('Y', '4', '2', '2') },
54 { AV_PIX_FMT_YUYV422, MKTAG('V', '4', '2', '2') },
55 { AV_PIX_FMT_YUYV422, MKTAG('V', 'Y', 'U', 'Y') },
56 { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'N', 'V') },
57 { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', 'V') },
58 { AV_PIX_FMT_YVYU422, MKTAG('Y', 'V', 'Y', 'U') }, /* Philips */
59 { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') },
60 { AV_PIX_FMT_UYVY422, MKTAG('H', 'D', 'Y', 'C') },
61 { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'V') },
62 { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'Y') },
63 { AV_PIX_FMT_UYVY422, MKTAG('u', 'y', 'v', '1') },
64 { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', '1') },
65 { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'R', 'n') }, /* Avid AVI Codec 1:1 */
66 { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', '1', 'x') }, /* Avid 1:1x */
67 { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'u', 'p') },
68 { AV_PIX_FMT_UYVY422, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */
69 { AV_PIX_FMT_UYVY422, MKTAG('a', 'u', 'v', '2') },
70 { AV_PIX_FMT_UYVY422, MKTAG('c', 'y', 'u', 'v') }, /* CYUV is also Creative YUV */
71 { AV_PIX_FMT_UYYVYY411, MKTAG('Y', '4', '1', '1') },
72 { AV_PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') },
73 { AV_PIX_FMT_NV12, MKTAG('N', 'V', '1', '2') },
74 { AV_PIX_FMT_NV21, MKTAG('N', 'V', '2', '1') },
75 { AV_PIX_FMT_VUYA, MKTAG('A', 'Y', 'U', 'V') }, /* MS 4:4:4:4 */
76
77 /* nut */
78 { AV_PIX_FMT_RGB555LE, MKTAG('R', 'G', 'B', 15) },
79 { AV_PIX_FMT_BGR555LE, MKTAG('B', 'G', 'R', 15) },
80 { AV_PIX_FMT_RGB565LE, MKTAG('R', 'G', 'B', 16) },
81 { AV_PIX_FMT_BGR565LE, MKTAG('B', 'G', 'R', 16) },
82 { AV_PIX_FMT_RGB555BE, MKTAG(15 , 'B', 'G', 'R') },
83 { AV_PIX_FMT_BGR555BE, MKTAG(15 , 'R', 'G', 'B') },
84 { AV_PIX_FMT_RGB565BE, MKTAG(16 , 'B', 'G', 'R') },
85 { AV_PIX_FMT_BGR565BE, MKTAG(16 , 'R', 'G', 'B') },
86 { AV_PIX_FMT_RGB444LE, MKTAG('R', 'G', 'B', 12) },
87 { AV_PIX_FMT_BGR444LE, MKTAG('B', 'G', 'R', 12) },
88 { AV_PIX_FMT_RGB444BE, MKTAG(12 , 'B', 'G', 'R') },
89 { AV_PIX_FMT_BGR444BE, MKTAG(12 , 'R', 'G', 'B') },
90 { AV_PIX_FMT_RGBA64LE, MKTAG('R', 'B', 'A', 64 ) },
91 { AV_PIX_FMT_BGRA64LE, MKTAG('B', 'R', 'A', 64 ) },
92 { AV_PIX_FMT_RGBA64BE, MKTAG(64 , 'R', 'B', 'A') },
93 { AV_PIX_FMT_BGRA64BE, MKTAG(64 , 'B', 'R', 'A') },
94 { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') },
95 { AV_PIX_FMT_RGB0, MKTAG('R', 'G', 'B', 0 ) },
96 { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') },
97 { AV_PIX_FMT_BGR0, MKTAG('B', 'G', 'R', 0 ) },
98 { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') },
99 { AV_PIX_FMT_0BGR, MKTAG( 0 , 'B', 'G', 'R') },
100 { AV_PIX_FMT_ARGB, MKTAG('A', 'R', 'G', 'B') },
101 { AV_PIX_FMT_0RGB, MKTAG( 0 , 'R', 'G', 'B') },
102 { AV_PIX_FMT_RGB24, MKTAG('R', 'G', 'B', 24 ) },
103 { AV_PIX_FMT_BGR24, MKTAG('B', 'G', 'R', 24 ) },
104 { AV_PIX_FMT_YUV411P, MKTAG('4', '1', '1', 'P') },
105 { AV_PIX_FMT_YUV422P, MKTAG('4', '2', '2', 'P') },
106 { AV_PIX_FMT_YUVJ422P, MKTAG('4', '2', '2', 'P') },
107 { AV_PIX_FMT_YUV440P, MKTAG('4', '4', '0', 'P') },
108 { AV_PIX_FMT_YUVJ440P, MKTAG('4', '4', '0', 'P') },
109 { AV_PIX_FMT_YUV444P, MKTAG('4', '4', '4', 'P') },
110 { AV_PIX_FMT_YUVJ444P, MKTAG('4', '4', '4', 'P') },
111 { AV_PIX_FMT_MONOWHITE,MKTAG('B', '1', 'W', '0') },
112 { AV_PIX_FMT_MONOBLACK,MKTAG('B', '0', 'W', '1') },
113 { AV_PIX_FMT_BGR8, MKTAG('B', 'G', 'R', 8 ) },
114 { AV_PIX_FMT_RGB8, MKTAG('R', 'G', 'B', 8 ) },
115 { AV_PIX_FMT_BGR4, MKTAG('B', 'G', 'R', 4 ) },
116 { AV_PIX_FMT_RGB4, MKTAG('R', 'G', 'B', 4 ) },
117 { AV_PIX_FMT_RGB4_BYTE,MKTAG('B', '4', 'B', 'Y') },
118 { AV_PIX_FMT_BGR4_BYTE,MKTAG('R', '4', 'B', 'Y') },
119 { AV_PIX_FMT_RGB48LE, MKTAG('R', 'G', 'B', 48 ) },
120 { AV_PIX_FMT_RGB48BE, MKTAG( 48, 'R', 'G', 'B') },
121 { AV_PIX_FMT_BGR48LE, MKTAG('B', 'G', 'R', 48 ) },
122 { AV_PIX_FMT_BGR48BE, MKTAG( 48, 'B', 'G', 'R') },
123 { AV_PIX_FMT_GRAY9LE, MKTAG('Y', '1', 0 , 9 ) },
124 { AV_PIX_FMT_GRAY9BE, MKTAG( 9 , 0 , '1', 'Y') },
125 { AV_PIX_FMT_GRAY10LE, MKTAG('Y', '1', 0 , 10 ) },
126 { AV_PIX_FMT_GRAY10BE, MKTAG(10 , 0 , '1', 'Y') },
127 { AV_PIX_FMT_GRAY12LE, MKTAG('Y', '1', 0 , 12 ) },
128 { AV_PIX_FMT_GRAY12BE, MKTAG(12 , 0 , '1', 'Y') },
129 { AV_PIX_FMT_GRAY14LE, MKTAG('Y', '1', 0 , 14 ) },
130 { AV_PIX_FMT_GRAY14BE, MKTAG(14 , 0 , '1', 'Y') },
131 { AV_PIX_FMT_GRAY16LE, MKTAG('Y', '1', 0 , 16 ) },
132 { AV_PIX_FMT_GRAY16BE, MKTAG(16 , 0 , '1', 'Y') },
133 { AV_PIX_FMT_YUV420P9LE, MKTAG('Y', '3', 11 , 9 ) },
134 { AV_PIX_FMT_YUV420P9BE, MKTAG( 9 , 11 , '3', 'Y') },
135 { AV_PIX_FMT_YUV422P9LE, MKTAG('Y', '3', 10 , 9 ) },
136 { AV_PIX_FMT_YUV422P9BE, MKTAG( 9 , 10 , '3', 'Y') },
137 { AV_PIX_FMT_YUV444P9LE, MKTAG('Y', '3', 0 , 9 ) },
138 { AV_PIX_FMT_YUV444P9BE, MKTAG( 9 , 0 , '3', 'Y') },
139 { AV_PIX_FMT_YUV420P10LE, MKTAG('Y', '3', 11 , 10 ) },
140 { AV_PIX_FMT_YUV420P10BE, MKTAG(10 , 11 , '3', 'Y') },
141 { AV_PIX_FMT_YUV422P10LE, MKTAG('Y', '3', 10 , 10 ) },
142 { AV_PIX_FMT_YUV422P10BE, MKTAG(10 , 10 , '3', 'Y') },
143 { AV_PIX_FMT_YUV444P10LE, MKTAG('Y', '3', 0 , 10 ) },
144 { AV_PIX_FMT_YUV444P10BE, MKTAG(10 , 0 , '3', 'Y') },
145 { AV_PIX_FMT_YUV420P12LE, MKTAG('Y', '3', 11 , 12 ) },
146 { AV_PIX_FMT_YUV420P12BE, MKTAG(12 , 11 , '3', 'Y') },
147 { AV_PIX_FMT_YUV422P12LE, MKTAG('Y', '3', 10 , 12 ) },
148 { AV_PIX_FMT_YUV422P12BE, MKTAG(12 , 10 , '3', 'Y') },
149 { AV_PIX_FMT_YUV444P12LE, MKTAG('Y', '3', 0 , 12 ) },
150 { AV_PIX_FMT_YUV444P12BE, MKTAG(12 , 0 , '3', 'Y') },
151 { AV_PIX_FMT_YUV420P14LE, MKTAG('Y', '3', 11 , 14 ) },
152 { AV_PIX_FMT_YUV420P14BE, MKTAG(14 , 11 , '3', 'Y') },
153 { AV_PIX_FMT_YUV422P14LE, MKTAG('Y', '3', 10 , 14 ) },
154 { AV_PIX_FMT_YUV422P14BE, MKTAG(14 , 10 , '3', 'Y') },
155 { AV_PIX_FMT_YUV444P14LE, MKTAG('Y', '3', 0 , 14 ) },
156 { AV_PIX_FMT_YUV444P14BE, MKTAG(14 , 0 , '3', 'Y') },
157 { AV_PIX_FMT_YUV420P16LE, MKTAG('Y', '3', 11 , 16 ) },
158 { AV_PIX_FMT_YUV420P16BE, MKTAG(16 , 11 , '3', 'Y') },
159 { AV_PIX_FMT_YUV422P16LE, MKTAG('Y', '3', 10 , 16 ) },
160 { AV_PIX_FMT_YUV422P16BE, MKTAG(16 , 10 , '3', 'Y') },
161 { AV_PIX_FMT_YUV444P16LE, MKTAG('Y', '3', 0 , 16 ) },
162 { AV_PIX_FMT_YUV444P16BE, MKTAG(16 , 0 , '3', 'Y') },
163 { AV_PIX_FMT_YUVA420P, MKTAG('Y', '4', 11 , 8 ) },
164 { AV_PIX_FMT_YUVA422P, MKTAG('Y', '4', 10 , 8 ) },
165 { AV_PIX_FMT_YUVA444P, MKTAG('Y', '4', 0 , 8 ) },
166 { AV_PIX_FMT_YA8, MKTAG('Y', '2', 0 , 8 ) },
167 { AV_PIX_FMT_PAL8, MKTAG('P', 'A', 'L', 8 ) },
168
169 { AV_PIX_FMT_YUVA420P9LE, MKTAG('Y', '4', 11 , 9 ) },
170 { AV_PIX_FMT_YUVA420P9BE, MKTAG( 9 , 11 , '4', 'Y') },
171 { AV_PIX_FMT_YUVA422P9LE, MKTAG('Y', '4', 10 , 9 ) },
172 { AV_PIX_FMT_YUVA422P9BE, MKTAG( 9 , 10 , '4', 'Y') },
173 { AV_PIX_FMT_YUVA444P9LE, MKTAG('Y', '4', 0 , 9 ) },
174 { AV_PIX_FMT_YUVA444P9BE, MKTAG( 9 , 0 , '4', 'Y') },
175 { AV_PIX_FMT_YUVA420P10LE, MKTAG('Y', '4', 11 , 10 ) },
176 { AV_PIX_FMT_YUVA420P10BE, MKTAG(10 , 11 , '4', 'Y') },
177 { AV_PIX_FMT_YUVA422P10LE, MKTAG('Y', '4', 10 , 10 ) },
178 { AV_PIX_FMT_YUVA422P10BE, MKTAG(10 , 10 , '4', 'Y') },
179 { AV_PIX_FMT_YUVA444P10LE, MKTAG('Y', '4', 0 , 10 ) },
180 { AV_PIX_FMT_YUVA444P10BE, MKTAG(10 , 0 , '4', 'Y') },
181 { AV_PIX_FMT_YUVA422P12LE, MKTAG('Y', '4', 10 , 12 ) },
182 { AV_PIX_FMT_YUVA422P12BE, MKTAG(12 , 10 , '4', 'Y') },
183 { AV_PIX_FMT_YUVA444P12LE, MKTAG('Y', '4', 0 , 12 ) },
184 { AV_PIX_FMT_YUVA444P12BE, MKTAG(12 , 0 , '4', 'Y') },
185 { AV_PIX_FMT_YUVA420P16LE, MKTAG('Y', '4', 11 , 16 ) },
186 { AV_PIX_FMT_YUVA420P16BE, MKTAG(16 , 11 , '4', 'Y') },
187 { AV_PIX_FMT_YUVA422P16LE, MKTAG('Y', '4', 10 , 16 ) },
188 { AV_PIX_FMT_YUVA422P16BE, MKTAG(16 , 10 , '4', 'Y') },
189 { AV_PIX_FMT_YUVA444P16LE, MKTAG('Y', '4', 0 , 16 ) },
190 { AV_PIX_FMT_YUVA444P16BE, MKTAG(16 , 0 , '4', 'Y') },
191
192 { AV_PIX_FMT_GBRP, MKTAG('G', '3', 00 , 8 ) },
193 { AV_PIX_FMT_GBRP9LE, MKTAG('G', '3', 00 , 9 ) },
194 { AV_PIX_FMT_GBRP9BE, MKTAG( 9 , 00 , '3', 'G') },
195 { AV_PIX_FMT_GBRP10LE, MKTAG('G', '3', 00 , 10 ) },
196 { AV_PIX_FMT_GBRP10BE, MKTAG(10 , 00 , '3', 'G') },
197 { AV_PIX_FMT_GBRP12LE, MKTAG('G', '3', 00 , 12 ) },
198 { AV_PIX_FMT_GBRP12BE, MKTAG(12 , 00 , '3', 'G') },
199 { AV_PIX_FMT_GBRP14LE, MKTAG('G', '3', 00 , 14 ) },
200 { AV_PIX_FMT_GBRP14BE, MKTAG(14 , 00 , '3', 'G') },
201 { AV_PIX_FMT_GBRP16LE, MKTAG('G', '3', 00 , 16 ) },
202 { AV_PIX_FMT_GBRP16BE, MKTAG(16 , 00 , '3', 'G') },
203
204 { AV_PIX_FMT_GBRAP, MKTAG('G', '4', 00 , 8 ) },
205 { AV_PIX_FMT_GBRAP10LE, MKTAG('G', '4', 00 , 10 ) },
206 { AV_PIX_FMT_GBRAP10BE, MKTAG(10 , 00 , '4', 'G') },
207 { AV_PIX_FMT_GBRAP12LE, MKTAG('G', '4', 00 , 12 ) },
208 { AV_PIX_FMT_GBRAP12BE, MKTAG(12 , 00 , '4', 'G') },
209 { AV_PIX_FMT_GBRAP16LE, MKTAG('G', '4', 00 , 16 ) },
210 { AV_PIX_FMT_GBRAP16BE, MKTAG(16 , 00 , '4', 'G') },
211
212 { AV_PIX_FMT_XYZ12LE, MKTAG('X', 'Y', 'Z' , 36 ) },
213 { AV_PIX_FMT_XYZ12BE, MKTAG(36 , 'Z' , 'Y', 'X') },
214
215 { AV_PIX_FMT_BAYER_BGGR8, MKTAG(0xBA, 'B', 'G', 8 ) },
216 { AV_PIX_FMT_BAYER_BGGR16LE, MKTAG(0xBA, 'B', 'G', 16 ) },
217 { AV_PIX_FMT_BAYER_BGGR16BE, MKTAG(16 , 'G', 'B', 0xBA) },
218 { AV_PIX_FMT_BAYER_RGGB8, MKTAG(0xBA, 'R', 'G', 8 ) },
219 { AV_PIX_FMT_BAYER_RGGB16LE, MKTAG(0xBA, 'R', 'G', 16 ) },
220 { AV_PIX_FMT_BAYER_RGGB16BE, MKTAG(16 , 'G', 'R', 0xBA) },
221 { AV_PIX_FMT_BAYER_GBRG8, MKTAG(0xBA, 'G', 'B', 8 ) },
222 { AV_PIX_FMT_BAYER_GBRG16LE, MKTAG(0xBA, 'G', 'B', 16 ) },
223 { AV_PIX_FMT_BAYER_GBRG16BE, MKTAG(16, 'B', 'G', 0xBA) },
224 { AV_PIX_FMT_BAYER_GRBG8, MKTAG(0xBA, 'G', 'R', 8 ) },
225 { AV_PIX_FMT_BAYER_GRBG16LE, MKTAG(0xBA, 'G', 'R', 16 ) },
226 { AV_PIX_FMT_BAYER_GRBG16BE, MKTAG(16, 'R', 'G', 0xBA) },
227
228 /* quicktime */
229 { AV_PIX_FMT_YUV420P, MKTAG('R', '4', '2', '0') }, /* Radius DV YUV PAL */
230 { AV_PIX_FMT_YUV411P, MKTAG('R', '4', '1', '1') }, /* Radius DV YUV NTSC */
231 { AV_PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') },
232 { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', 'y') },
233 { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'U', 'I') }, /* FIXME merge both fields */
234 { AV_PIX_FMT_UYVY422, MKTAG('b', 'x', 'y', 'v') },
235 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
236 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
237 { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 Bit */
238 { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
239 { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') },
240 { AV_PIX_FMT_RGB565BE,MKTAG('B', '5', '6', '5') },
241 { AV_PIX_FMT_BGR24, MKTAG('2', '4', 'B', 'G') },
242 { AV_PIX_FMT_BGR24, MKTAG('b', 'x', 'b', 'g') },
243 { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') },
244 { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') },
245 { AV_PIX_FMT_RGB24, MKTAG('b', 'x', 'r', 'g') },
246 { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') },
247 { AV_PIX_FMT_GRAY16BE,MKTAG('b', '1', '6', 'g') },
248 { AV_PIX_FMT_RGB48BE, MKTAG('b', '4', '8', 'r') },
249 { AV_PIX_FMT_RGBA64BE,MKTAG('b', '6', '4', 'a') },
250 { AV_PIX_FMT_BAYER_RGGB16BE, MKTAG('B', 'G', 'G', 'R') },
251
252 /* vlc */
253 { AV_PIX_FMT_YUV410P, MKTAG('I', '4', '1', '0') },
254 { AV_PIX_FMT_YUV411P, MKTAG('I', '4', '1', '1') },
255 { AV_PIX_FMT_YUV422P, MKTAG('I', '4', '2', '2') },
256 { AV_PIX_FMT_YUV440P, MKTAG('I', '4', '4', '0') },
257 { AV_PIX_FMT_YUV444P, MKTAG('I', '4', '4', '4') },
258 { AV_PIX_FMT_YUVJ420P, MKTAG('J', '4', '2', '0') },
259 { AV_PIX_FMT_YUVJ422P, MKTAG('J', '4', '2', '2') },
260 { AV_PIX_FMT_YUVJ440P, MKTAG('J', '4', '4', '0') },
261 { AV_PIX_FMT_YUVJ444P, MKTAG('J', '4', '4', '4') },
262 { AV_PIX_FMT_YUVA444P, MKTAG('Y', 'U', 'V', 'A') },
263 { AV_PIX_FMT_YUVA420P, MKTAG('I', '4', '0', 'A') },
264 { AV_PIX_FMT_YUVA422P, MKTAG('I', '4', '2', 'A') },
265 { AV_PIX_FMT_RGB8, MKTAG('R', 'G', 'B', '2') },
266 { AV_PIX_FMT_RGB555LE, MKTAG('R', 'V', '1', '5') },
267 { AV_PIX_FMT_RGB565LE, MKTAG('R', 'V', '1', '6') },
268 { AV_PIX_FMT_BGR24, MKTAG('R', 'V', '2', '4') },
269 { AV_PIX_FMT_BGR0, MKTAG('R', 'V', '3', '2') },
270 { AV_PIX_FMT_RGBA, MKTAG('A', 'V', '3', '2') },
271 { AV_PIX_FMT_YUV420P9LE, MKTAG('I', '0', '9', 'L') },
272 { AV_PIX_FMT_YUV420P9BE, MKTAG('I', '0', '9', 'B') },
273 { AV_PIX_FMT_YUV422P9LE, MKTAG('I', '2', '9', 'L') },
274 { AV_PIX_FMT_YUV422P9BE, MKTAG('I', '2', '9', 'B') },
275 { AV_PIX_FMT_YUV444P9LE, MKTAG('I', '4', '9', 'L') },
276 { AV_PIX_FMT_YUV444P9BE, MKTAG('I', '4', '9', 'B') },
277 { AV_PIX_FMT_YUV420P10LE, MKTAG('I', '0', 'A', 'L') },
278 { AV_PIX_FMT_YUV420P10BE, MKTAG('I', '0', 'A', 'B') },
279 { AV_PIX_FMT_YUV422P10LE, MKTAG('I', '2', 'A', 'L') },
280 { AV_PIX_FMT_YUV422P10BE, MKTAG('I', '2', 'A', 'B') },
281 { AV_PIX_FMT_YUV444P10LE, MKTAG('I', '4', 'A', 'L') },
282 { AV_PIX_FMT_YUV444P10BE, MKTAG('I', '4', 'A', 'B') },
283 { AV_PIX_FMT_YUV420P12LE, MKTAG('I', '0', 'C', 'L') },
284 { AV_PIX_FMT_YUV420P12BE, MKTAG('I', '0', 'C', 'B') },
285 { AV_PIX_FMT_YUV422P12LE, MKTAG('I', '2', 'C', 'L') },
286 { AV_PIX_FMT_YUV422P12BE, MKTAG('I', '2', 'C', 'B') },
287 { AV_PIX_FMT_YUV444P12LE, MKTAG('I', '4', 'C', 'L') },
288 { AV_PIX_FMT_YUV444P12BE, MKTAG('I', '4', 'C', 'B') },
289 { AV_PIX_FMT_YUV420P16LE, MKTAG('I', '0', 'F', 'L') },
290 { AV_PIX_FMT_YUV420P16BE, MKTAG('I', '0', 'F', 'B') },
291 { AV_PIX_FMT_YUV444P16LE, MKTAG('I', '4', 'F', 'L') },
292 { AV_PIX_FMT_YUV444P16BE, MKTAG('I', '4', 'F', 'B') },
293
294 /* special */
295 { AV_PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */
296 { AV_PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */
297
298 { AV_PIX_FMT_NONE, 0 },
299 };
300
301 const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void)
302 {
303 return raw_pix_fmt_tags;
304 }
305
306 16952 unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt)
307 {
308 16952 const PixelFormatTag *tags = raw_pix_fmt_tags;
309
2/2
✓ Branch 0 taken 909279 times.
✓ Branch 1 taken 1260 times.
910539 while (tags->pix_fmt >= 0) {
310
2/2
✓ Branch 0 taken 15692 times.
✓ Branch 1 taken 893587 times.
909279 if (tags->pix_fmt == fmt)
311 15692 return tags->fourcc;
312 893587 tags++;
313 }
314 1260 return 0;
315 }
316
317 static const PixelFormatTag pix_fmt_bps_avi[] = {
318 { AV_PIX_FMT_PAL8, 1 },
319 { AV_PIX_FMT_PAL8, 2 },
320 { AV_PIX_FMT_PAL8, 4 },
321 { AV_PIX_FMT_PAL8, 8 },
322 { AV_PIX_FMT_RGB444LE, 12 },
323 { AV_PIX_FMT_RGB555LE, 15 },
324 { AV_PIX_FMT_RGB555LE, 16 },
325 { AV_PIX_FMT_BGR24, 24 },
326 { AV_PIX_FMT_BGRA, 32 },
327 { AV_PIX_FMT_NONE, 0 },
328 };
329
330 static const PixelFormatTag pix_fmt_bps_mov[] = {
331 { AV_PIX_FMT_PAL8, 1 },
332 { AV_PIX_FMT_PAL8, 2 },
333 { AV_PIX_FMT_PAL8, 4 },
334 { AV_PIX_FMT_PAL8, 8 },
335 { AV_PIX_FMT_RGB555BE, 16 },
336 { AV_PIX_FMT_RGB24, 24 },
337 { AV_PIX_FMT_ARGB, 32 },
338 { AV_PIX_FMT_PAL8, 33 },
339 { AV_PIX_FMT_NONE, 0 },
340 };
341
342 1401 static enum AVPixelFormat find_pix_fmt(const PixelFormatTag *tags,
343 unsigned int fourcc)
344 {
345
2/2
✓ Branch 0 taken 12481 times.
✓ Branch 1 taken 215 times.
12696 while (tags->pix_fmt != AV_PIX_FMT_NONE) {
346
2/2
✓ Branch 0 taken 1186 times.
✓ Branch 1 taken 11295 times.
12481 if (tags->fourcc == fourcc)
347 1186 return tags->pix_fmt;
348 11295 tags++;
349 }
350 215 return AV_PIX_FMT_NONE;
351 }
352
353 1401 enum AVPixelFormat avpriv_pix_fmt_find(enum PixelFormatTagLists list,
354 unsigned fourcc)
355 {
356 const PixelFormatTag *tags;
357
358
3/4
✓ Branch 0 taken 1097 times.
✓ Branch 1 taken 292 times.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
1401 switch (list) {
359 1097 case PIX_FMT_LIST_RAW:
360 1097 tags = raw_pix_fmt_tags;
361 1097 break;
362 292 case PIX_FMT_LIST_AVI:
363 292 tags = pix_fmt_bps_avi;
364 292 break;
365 12 case PIX_FMT_LIST_MOV:
366 12 tags = pix_fmt_bps_mov;
367 12 break;
368 }
369 1401 return find_pix_fmt(tags, fourcc);
370 }
371