libweed 0.6.0

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Macros
weed-compat.h
Go to the documentation of this file.
1 /* WEED is free software; you can redistribute it and/or
2 modify it under the terms of the GNU Lesser General Public
3 License as published by the Free Software Foundation; either
4 version 3 of the License, or (at your option) any later version.
5
6 Weed is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 Lesser General Public License for more details.
10
11 You should have received a copy of the GNU Lesser General Public
12 License along with this source code; if not, write to the Free Software
13 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
14
15
16 Weed is developed by:
17
18 Gabriel "Salsaman" Finch - http://lives.sourceforge.net
19
20 mainly based on LiViDO, which is developed by:
21
22
23 Niels Elburg - http://veejay.sf.net
24
25 Gabriel "Salsaman" Finch - http://lives.sourceforge.net
26
27 Denis "Jaromil" Rojo - http://freej.dyne.org
28
29 Tom Schouten - http://zwizwa.fartit.com
30
31 Andraz Tori - http://cvs.cinelerra.org
32
33 reviewed with suggestions and contributions from:
34
35 Silvano "Kysucix" Galliani - http://freej.dyne.org
36
37 Kentaro Fukuchi - http://megaui.net/fukuchi
38
39 Jun Iio - http://www.malib.net
40
41 Carlo Prelz - http://www2.fluido.as:8080/
42
43 */
44
45 /* (C) Gabriel "Salsaman" Finch, 2005 - 2012 */
46
47 #ifndef __WEED_COMPAT_H__
48 #define __WEED_COMPAT_H__
49
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif /* __cplusplus */
54
55
56 #ifdef NEED_FOURCC_COMPAT
57
58 #ifndef __WEED_PALETTES_H__
59 #include <weed/weed-palettes.h>
60 #endif
61
62 int fourccp_to_weedp(unsigned int fourcc, int bpp, int *interlaced, int *sampling,
63 int *sspace, int *clamping) {
64 // inputs are fourcc and bpp
65 // returns int weed_palette
66
67 // optionally sets interlaced (0 = none, 1 = interlaced), sampling, subspace and clamping
68
69
70
71 // TODO - this is probably wrong for some formats and needs testing/verifying with various devices
72 // fourcc colorcodes are a nasty mess, and should be avoided whenever possible
73
74 // data from http://www.fourcc.org
75
76 if (clamping!=NULL) *clamping=WEED_YUV_CLAMPING_CLAMPED;
77 if (interlaced!=NULL) *interlaced=0;
78 if (sspace!=NULL) *sspace=WEED_YUV_SUBSPACE_YCBCR;
79 if (sampling!=NULL) *sampling=WEED_YUV_SAMPLING_DEFAULT;
80
81 switch (fourcc) {
82
83 // RGB formats
84
85 case 0x32524742: // BGR3
86 case 0x33524742: // BGR3 - tested and OK
87 case 0x34524742: // BGR4
88 if (bpp==24) return WEED_PALETTE_BGR24;
89 if (bpp==32) return WEED_PALETTE_BGRA32;
90 break;
91
92 case 0x00000000: // BI_RGB - RGB or BGR ???
93 case 0x32776172: // raw2 - RGB or BGR ???
94
95 case 0x32424752: // RGB2
96 case 0x33424752: // RGB3
97 case 0x34424752: // RGB4
98 if (bpp==24) return WEED_PALETTE_RGB24;
99 if (bpp==32) return WEED_PALETTE_RGBA32;
100 break;
101 case 0x41424752: // RGBA
102 if (bpp==32) return WEED_PALETTE_RGBA32;
103 break;
104
105
106 // YUV packed formats
107
108 case 0x56595549: // IUYV
109 if (interlaced!=NULL) *interlaced=1;
110 return WEED_PALETTE_UYVY;
111 case 0x31555949: // IYU1
112 case 0x31313459: // Y411
113 return WEED_PALETTE_YUV411;
114 case 0x32555949: // IYU2
115 return WEED_PALETTE_YUV888;
116 case 0x43594448: // HDYC
117 if (sspace!=NULL) *sspace=WEED_YUV_SUBSPACE_BT709;
118 return WEED_PALETTE_UYVY;
119 case 0x564E5955: // UYNV
120 case 0x59565955: // UYVY
121 case 0x32323459: // Y422
122 case 0x76757963: // cyuv - ???
123 return WEED_PALETTE_UYVY;
124 case 0x32595559: // YUY2
125 case 0x56595559: // YUYV - tested and OK
126 case 0x564E5559: // YUNV
127 case 0x31313259: // Y211 - ???
128 return WEED_PALETTE_YUYV;
129 case 0x59455247: // grey
130 if (clamping!=NULL) *clamping=WEED_YUV_CLAMPING_UNCLAMPED;
131 case 0x30303859: // Y800
132 case 0x20203859: // Y8
133 return WEED_PALETTE_A8;
134
135
136 // YUV planar formats
137 case 0x41565559: // YUVA
138 return WEED_PALETTE_YUVA4444P;
139 break;
140 case 0x34343449: // I444
141 return WEED_PALETTE_YUV444P;
142 break;
143 case 0x50323234: // 422P ??
144 return WEED_PALETTE_YUV422P;
145 break;
146 case 0x32315659: // YV12
147 return WEED_PALETTE_YVU420P;
148 case 0x30323449: // I420
149 case 0x56555949: // IYUV
150 case 0x32315559: // YU12 ??
151 return WEED_PALETTE_YUV420P;
152
153 case 0x3032344a: // J420
154 if (clamping!=NULL) *clamping=WEED_YUV_CLAMPING_UNCLAMPED;
155 return WEED_PALETTE_YUV420P;
156 case 0x3232344a: // J422
157 if (clamping!=NULL) *clamping=WEED_YUV_CLAMPING_UNCLAMPED;
158 return WEED_PALETTE_YUV422P;
159 case 0x3434344a: // J444
160 if (clamping!=NULL) *clamping=WEED_YUV_CLAMPING_UNCLAMPED;
161 return WEED_PALETTE_YUV444P;
162
163
164 // known formats we cannot use
165 case 0x50424752: // RGBP - palettised RGB
166 case 0x4f424752: // RGB0 - 15 or 16 bit RGB
167 case 0x51424752: // RGBQ - 15 or 16 bit RGB
168 case 0x52424752: // RGBR - ???
169
170 case 0x3231564e: // NV12 - planar Y, packed UV
171 case 0x30313276: // v210 - 10 bit 422, packed
172
173 case 0x39565559: // YUV9 - 410 planar palette
174 case 0x30313449: // I410 - 410 planar palette
175
176 case 0x31313449: // I411 - 411 planar palette
177 case 0x30343449: // I440 - 440 planar palette
178 case 0x30343450: // J440 - 440 planar palette unclamped
179
180 // no match
181 default:
182 return WEED_PALETTE_END;
183 }
184 return WEED_PALETTE_END;
185 }
186
187
188
189
190 #endif
191
192
193
194
195
196
197
198
199 #ifdef HAVE_AVCODEC
200 #ifdef HAVE_AVUTIL
201
202 // compatibility with libavcodec
203
204 #include <libavcodec/avcodec.h>
205 #include <libavutil/pixfmt.h>
206
207 typedef struct AVCodecTag {
208 int id;
209 unsigned int tag;
210 } AVCodecTag;
211
212 #ifndef MKTAG
213 #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
214 #endif
215
216
217 #if (LIBAVCODEC_VERSION_MAJOR > 54)
218 #define CodecID AVCodecID
219
220 #define CODEC_ID_NONE AV_CODEC_ID_NONE
221 #define CODEC_ID_H264 AV_CODEC_ID_H264
222 #define CODEC_ID_H263 AV_CODEC_ID_H263
223 #define CODEC_ID_H263P AV_CODEC_ID_H263P
224 #define CODEC_ID_H263I AV_CODEC_ID_H263I
225 #define CODEC_ID_H261 AV_CODEC_ID_H261
226 #define CODEC_ID_MPEG4 AV_CODEC_ID_MPEG4
227 #define CODEC_ID_MSMPEG4V3 AV_CODEC_ID_MSMPEG4V3
228 #define CODEC_ID_MSMPEG4V2 AV_CODEC_ID_MSMPEG4V2
229 #define CODEC_ID_MSMPEG4V1 AV_CODEC_ID_MSMPEG4V1
230 #define CODEC_ID_WMV1 AV_CODEC_ID_WMV1
231 #define CODEC_ID_WMV2 AV_CODEC_ID_WMV2
232 #define CODEC_ID_DVVIDEO AV_CODEC_ID_DVVIDEO
233 #define CODEC_ID_MPEG1VIDEO AV_CODEC_ID_MPEG1VIDEO
234 #define CODEC_ID_MPEG2VIDEO AV_CODEC_ID_MPEG2VIDEO
235 #define CODEC_ID_MJPEG AV_CODEC_ID_MJPEG
236 #define CODEC_ID_LJPEG AV_CODEC_ID_LJPEG
237 #define CODEC_ID_JPEGLS AV_CODEC_ID_JPEGLS
238 #define CODEC_ID_HUFFYUV AV_CODEC_ID_HUFFYUV
239 #define CODEC_ID_FFVHUFF AV_CODEC_ID_FFVHUFF
240 #define CODEC_ID_CYUV AV_CODEC_ID_CYUV
241 #define CODEC_ID_RAWVIDEO AV_CODEC_ID_RAWVIDEO
242 #define CODEC_ID_INDEO2 AV_CODEC_ID_INDEO2
243 #define CODEC_ID_INDEO3 AV_CODEC_ID_INDEO3
244 #define CODEC_ID_INDEO4 AV_CODEC_ID_INDEO4
245 #define CODEC_ID_INDEO5 AV_CODEC_ID_INDEO5
246 #define CODEC_ID_VP3 AV_CODEC_ID_VP3
247 #define CODEC_ID_VP5 AV_CODEC_ID_VP5
248 #define CODEC_ID_VP6 AV_CODEC_ID_VP6
249 #define CODEC_ID_VP6F AV_CODEC_ID_VP6F
250 #define CODEC_ID_VP6A AV_CODEC_ID_VP6A
251 #define CODEC_ID_ASV1 AV_CODEC_ID_ASV1
252 #define CODEC_ID_ASV2 AV_CODEC_ID_ASV2
253 #define CODEC_ID_VCR1 AV_CODEC_ID_VCR1
254 #define CODEC_ID_FFV1 AV_CODEC_ID_FFV1
255 #define CODEC_ID_XAN_WC4 AV_CODEC_ID_XAN_WC4
256 #define CODEC_ID_MIMIC AV_CODEC_ID_MIMIC
257 #define CODEC_ID_MSRLE AV_CODEC_ID_MSRLE
258 #define CODEC_ID_MSVIDEO1 AV_CODEC_ID_MSVIDEO1
259 #define CODEC_ID_CINEPAK AV_CODEC_ID_CINEPAK
260 #define CODEC_ID_TRUEMOTION1 AV_CODEC_ID_TRUEMOTION1
261 #define CODEC_ID_TRUEMOTION2 AV_CODEC_ID_TRUEMOTION2
262 #define CODEC_ID_MSZH AV_CODEC_ID_MSZH
263 #define CODEC_ID_ZLIB AV_CODEC_ID_ZLIB
264
265 #if FF_API_SNOW
266 #define CODEC_ID_SNOW AV_CODEC_ID_SNOW
267 #endif
268
269 #define CODEC_ID_4XM AV_CODEC_ID_4XM
270 #define CODEC_ID_FLV1 AV_CODEC_ID_FLV1
271 #define CODEC_ID_FLASHSV AV_CODEC_ID_FLASHSV
272 #define CODEC_ID_SVQ1 AV_CODEC_ID_SVQ1
273 #define CODEC_ID_TSCC AV_CODEC_ID_TSCC
274 #define CODEC_ID_ULTI AV_CODEC_ID_ULTI
275 #define CODEC_ID_VIXL AV_CODEC_ID_VIXL
276 #define CODEC_ID_QPEG AV_CODEC_ID_QPEG
277 #define CODEC_ID_WMV3 AV_CODEC_ID_WMV3
278 #define CODEC_ID_VC1 AV_CODEC_ID_VC1
279 #define CODEC_ID_LOCO AV_CODEC_ID_LOCO
280 #define CODEC_ID_WNV1 AV_CODEC_ID_WNV1
281 #define CODEC_ID_AASC AV_CODEC_ID_AASC
282 #define CODEC_ID_FRAPS AV_CODEC_ID_FRAPS
283 #define CODEC_ID_THEORA AV_CODEC_ID_THEORA
284 #define CODEC_ID_CSCD AV_CODEC_ID_CSCD
285 #define CODEC_ID_ZMBV AV_CODEC_ID_ZMBV
286 #define CODEC_ID_KMVC AV_CODEC_ID_KMVC
287 #define CODEC_ID_CAVS AV_CODEC_ID_CAVS
288 #define CODEC_ID_JPEG2000 AV_CODEC_ID_JPEG2000
289 #define CODEC_ID_VMNC AV_CODEC_ID_VMNC
290 #define CODEC_ID_TARGA AV_CODEC_ID_TARGA
291 #define CODEC_ID_PNG AV_CODEC_ID_PNG
292 #define CODEC_ID_GIF AV_CODEC_ID_GIF
293 #define CODEC_ID_TIFF AV_CODEC_ID_TIFF
294 #define CODEC_ID_CLJR AV_CODEC_ID_CLJR
295 #define CODEC_ID_DIRAC AV_CODEC_ID_DIRAC
296 #define CODEC_ID_RPZA AV_CODEC_ID_RPZA
297 #define CODEC_ID_SP5X AV_CODEC_ID_SP5X
298
299 #define CODEC_ID_FLASHSV2 AV_CODEC_ID_FLASHSV2
300 #define CODEC_ID_TEXT AV_CODEC_ID_TEXT
301 #define CODEC_ID_SSA AV_CODEC_ID_SSA
302 #define CODEC_ID_SRT AV_CODEC_ID_SRT
303 #define CODEC_ID_VP8 AV_CODEC_ID_VP8
304 #define CODEC_ID_RV10 AV_CODEC_ID_RV10
305 #define CODEC_ID_RV20 AV_CODEC_ID_RV20
306 #define CODEC_ID_RV30 AV_CODEC_ID_RV30
307 #define CODEC_ID_RV40 AV_CODEC_ID_RV40
308 #define CODEC_ID_MP3 AV_CODEC_ID_MP3
309 #define CODEC_ID_MP2 AV_CODEC_ID_MP2
310 #define CODEC_ID_AAC AV_CODEC_ID_AAC
311 #define CODEC_ID_PCM_BLURAY AV_CODEC_ID_PCM_BLURAY
312 #define CODEC_ID_AC3 AV_CODEC_ID_AC3
313 #define CODEC_ID_VORBIS AV_CODEC_ID_VORBIS
314 #define CODEC_ID_EAC3 AV_CODEC_ID_EAC3
315 #define CODEC_ID_DTS AV_CODEC_ID_DTS
316 #define CODEC_ID_TRUEHD AV_CODEC_ID_TRUEHD
317 #define CODEC_ID_S302M AV_CODEC_ID_S302M
318 #define CODEC_ID_DVB_TELETEXT AV_CODEC_ID_DVB_TELETEXT
319 #define CODEC_ID_DVB_SUBTITLE AV_CODEC_ID_DVB_SUBTITLE
320 #define CODEC_ID_DVD_SUBTITLE AV_CODEC_ID_DVD_SUBTITLE
321
322 #define CODEC_ID_MOV_TEXT AV_CODEC_ID_MOV_TEXT
323 #define CODEC_ID_MP4ALS AV_CODEC_ID_MP4ALS
324 #define CODEC_ID_QCELP AV_CODEC_ID_QCELP
325 #define CODEC_ID_MPEG4SYSTEMS AV_CODEC_ID_MPEG4SYSTEMS
326
327 #define CODEC_ID_MPEG2TS AV_CODEC_ID_MPEG2TS
328 #define CODEC_ID_AAC_LATM AV_CODEC_ID_AAC_LATM
329 #define CODEC_ID_HDMV_PGS_SUBTITLE AV_CODEC_ID_HDMV_PGS_SUBTITLE
330
331 #define CODEC_ID_FLAC AV_CODEC_ID_FLAC
332 #define CODEC_ID_MLP AV_CODEC_ID_MLP
333
334 #define CODEC_ID_PCM_F32LE AV_CODEC_ID_PCM_F32LE
335 #define CODEC_ID_PCM_F64LE AV_CODEC_ID_PCM_F64LE
336
337 #define CODEC_ID_PCM_S16BE AV_CODEC_ID_PCM_S16BE
338 #define CODEC_ID_PCM_S24BE AV_CODEC_ID_PCM_S24BE
339 #define CODEC_ID_PCM_S32BE AV_CODEC_ID_PCM_S32BE
340
341 #define CODEC_ID_PCM_S16LE AV_CODEC_ID_PCM_S16LE
342 #define CODEC_ID_PCM_S24LE AV_CODEC_ID_PCM_S24LE
343 #define CODEC_ID_PCM_S32LE AV_CODEC_ID_PCM_S32LE
344
345 #define CODEC_ID_PCM_U8 AV_CODEC_ID_PCM_U8
346
347 #define CODEC_ID_QDM2 AV_CODEC_ID_QDM2
348 #define CODEC_ID_RA_144 AV_CODEC_ID_RA_144
349 #define CODEC_ID_RA_288 AV_CODEC_ID_RA_288
350 #define CODEC_ID_ATRAC3 AV_CODEC_ID_ATRAC3
351 #define CODEC_ID_COOK AV_CODEC_ID_COOK
352 #define CODEC_ID_SIPR AV_CODEC_ID_SIPR
353 #define CODEC_ID_TTA AV_CODEC_ID_TTA
354 #define CODEC_ID_WAVPACK AV_CODEC_ID_WAVPACK
355
356 #define CODEC_ID_TTF AV_CODEC_ID_TTF
357
358 // from mkv_decoder.h
359 #define CODEC_ID_R10K AV_CODEC_ID_R10K
360 #define CODEC_ID_R210 AV_CODEC_ID_R210
361 #define CODEC_ID_V210 AV_CODEC_ID_V210
362 #define CODEC_ID_MJPEGB AV_CODEC_ID_MJPEGB
363 #define CODEC_ID_SVQ3 AV_CODEC_ID_SVQ3
364 #define CODEC_ID_8BPS AV_CODEC_ID_8BPS
365 #define CODEC_ID_SMC AV_CODEC_ID_SMC
366 #define CODEC_ID_QTRLE AV_CODEC_ID_QTRLE
367 #define CODEC_ID_QDRAW AV_CODEC_ID_QDRAW
368 #define CODEC_ID_DNXHD AV_CODEC_ID_DNXHD
369 #define CODEC_ID_SGI AV_CODEC_ID_SGI
370 #define CODEC_ID_DPX AV_CODEC_ID_DPX
371 #define CODEC_ID_PRORES AV_CODEC_ID_PRORES
372
373
374
375
376 #endif
377
378 const AVCodecTag codec_bmp_tags[] = {
379 { CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
380 { CODEC_ID_H264, MKTAG('h', '2', '6', '4') },
381 { CODEC_ID_H264, MKTAG('X', '2', '6', '4') },
382 { CODEC_ID_H264, MKTAG('x', '2', '6', '4') },
383 { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') },
384 { CODEC_ID_H264, MKTAG('V', 'S', 'S', 'H') },
385 { CODEC_ID_H263, MKTAG('H', '2', '6', '3') },
386 { CODEC_ID_H263, MKTAG('X', '2', '6', '3') },
387 { CODEC_ID_H263, MKTAG('T', '2', '6', '3') },
388 { CODEC_ID_H263, MKTAG('L', '2', '6', '3') },
389 { CODEC_ID_H263, MKTAG('V', 'X', '1', 'K') },
390 { CODEC_ID_H263, MKTAG('Z', 'y', 'G', 'o') },
391 { CODEC_ID_H263P, MKTAG('H', '2', '6', '3') },
392 { CODEC_ID_H263I, MKTAG('I', '2', '6', '3') }, /* intel h263 */
393 { CODEC_ID_H261, MKTAG('H', '2', '6', '1') },
394 { CODEC_ID_H263P, MKTAG('U', '2', '6', '3') },
395 { CODEC_ID_H263P, MKTAG('v', 'i', 'v', '1') },
396 { CODEC_ID_MPEG4, MKTAG('F', 'M', 'P', '4') },
397 { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') },
398 { CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0') },
399 { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
400 { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
401 { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
402 { CODEC_ID_MPEG4, MKTAG(4 , 0 , 0 , 0) }, /* some broken avi use this */
403 { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', '1') },
404 { CODEC_ID_MPEG4, MKTAG('B', 'L', 'Z', '0') },
405 { CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
406 { CODEC_ID_MPEG4, MKTAG('U', 'M', 'P', '4') },
407 { CODEC_ID_MPEG4, MKTAG('W', 'V', '1', 'F') },
408 { CODEC_ID_MPEG4, MKTAG('S', 'E', 'D', 'G') },
409 { CODEC_ID_MPEG4, MKTAG('R', 'M', 'P', '4') },
410 { CODEC_ID_MPEG4, MKTAG('3', 'I', 'V', '2') },
411 { CODEC_ID_MPEG4, MKTAG('F', 'F', 'D', 'S') },
412 { CODEC_ID_MPEG4, MKTAG('F', 'V', 'F', 'W') },
413 { CODEC_ID_MPEG4, MKTAG('D', 'C', 'O', 'D') },
414 { CODEC_ID_MPEG4, MKTAG('M', 'V', 'X', 'M') },
415 { CODEC_ID_MPEG4, MKTAG('P', 'M', '4', 'V') },
416 { CODEC_ID_MPEG4, MKTAG('S', 'M', 'P', '4') },
417 { CODEC_ID_MPEG4, MKTAG('D', 'X', 'G', 'M') },
418 { CODEC_ID_MPEG4, MKTAG('V', 'I', 'D', 'M') },
419 { CODEC_ID_MPEG4, MKTAG('M', '4', 'T', '3') },
420 { CODEC_ID_MPEG4, MKTAG('G', 'E', 'O', 'X') },
421 { CODEC_ID_MPEG4, MKTAG('H', 'D', 'X', '4') }, /* flipped video */
422 { CODEC_ID_MPEG4, MKTAG('D', 'M', 'K', '2') },
423 { CODEC_ID_MPEG4, MKTAG('D', 'I', 'G', 'I') },
424 { CODEC_ID_MPEG4, MKTAG('I', 'N', 'M', 'C') },
425 { CODEC_ID_MPEG4, MKTAG('E', 'P', 'H', 'V') }, /* Ephv MPEG-4 */
426 { CODEC_ID_MPEG4, MKTAG('E', 'M', '4', 'A') },
427 { CODEC_ID_MPEG4, MKTAG('M', '4', 'C', 'C') }, /* Divio MPEG-4 */
428 { CODEC_ID_MPEG4, MKTAG('S', 'N', '4', '0') },
429 { CODEC_ID_MPEG4, MKTAG('V', 'S', 'P', 'X') },
430 { CODEC_ID_MPEG4, MKTAG('U', 'L', 'D', 'X') },
431 { CODEC_ID_MPEG4, MKTAG('G', 'E', 'O', 'V') },
432 { CODEC_ID_MPEG4, MKTAG('S', 'I', 'P', 'P') }, /* Samsung SHR-6040 */
433 { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3') }, /* default signature when using MSMPEG4 */
434 { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
435 { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', 'G', '3') },
436 { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '5') },
437 { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '6') },
438 { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '4') },
439 { CODEC_ID_MSMPEG4V3, MKTAG('D', 'V', 'X', '3') },
440 { CODEC_ID_MSMPEG4V3, MKTAG('A', 'P', '4', '1') },
441 { CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '1') },
442 { CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '0') },
443 { CODEC_ID_MSMPEG4V2, MKTAG('M', 'P', '4', '2') },
444 { CODEC_ID_MSMPEG4V2, MKTAG('D', 'I', 'V', '2') },
445 { CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', 'G', '4') },
446 { CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', '4', '1') },
447 { CODEC_ID_WMV1, MKTAG('W', 'M', 'V', '1') },
448 { CODEC_ID_WMV2, MKTAG('W', 'M', 'V', '2') },
449 { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd') },
450 { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'd') },
451 { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
452 { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'l') },
453 { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '2', '5') },
454 { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', '0') },
455 { CODEC_ID_DVVIDEO, MKTAG('c', 'd', 'v', 'c') }, /* Canopus DV */
456 { CODEC_ID_DVVIDEO, MKTAG('C', 'D', 'V', 'H') }, /* Canopus DV */
457 { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') },
458 { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', 's') },
459 { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
460 { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '1') },
461 { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '2') },
462 { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', '2') },
463 { CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'E', 'G') },
464 { CODEC_ID_MPEG1VIDEO, MKTAG('P', 'I', 'M', '1') },
465 { CODEC_ID_MPEG2VIDEO, MKTAG('P', 'I', 'M', '2') },
466 { CODEC_ID_MPEG1VIDEO, MKTAG('V', 'C', 'R', '2') },
467 { CODEC_ID_MPEG1VIDEO, MKTAG(1 , 0 , 0 , 16) },
468 { CODEC_ID_MPEG2VIDEO, MKTAG(2 , 0 , 0 , 16) },
469 { CODEC_ID_MPEG4, MKTAG(4 , 0 , 0 , 16) },
470 { CODEC_ID_MPEG2VIDEO, MKTAG('D', 'V', 'R', ' ') },
471 { CODEC_ID_MPEG2VIDEO, MKTAG('M', 'M', 'E', 'S') },
472 { CODEC_ID_MPEG2VIDEO, MKTAG('L', 'M', 'P', '2') }, /* Lead MPEG2 in avi */
473 { CODEC_ID_MPEG2VIDEO, MKTAG('s', 'l', 'i', 'f') },
474 { CODEC_ID_MPEG2VIDEO, MKTAG('E', 'M', '2', 'V') },
475 { CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') },
476 { CODEC_ID_MJPEG, MKTAG('L', 'J', 'P', 'G') },
477 { CODEC_ID_MJPEG, MKTAG('d', 'm', 'b', '1') },
478 { CODEC_ID_MJPEG, MKTAG('m', 'j', 'p', 'a') },
479 { CODEC_ID_LJPEG, MKTAG('L', 'J', 'P', 'G') },
480 { CODEC_ID_MJPEG, MKTAG('J', 'P', 'G', 'L') }, /* Pegasus lossless JPEG */
481 { CODEC_ID_JPEGLS, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - encoder */
482 { CODEC_ID_MJPEG, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - decoder */
483 { CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') },
484 { CODEC_ID_MJPEG, MKTAG('I', 'J', 'P', 'G') },
485 { CODEC_ID_MJPEG, MKTAG('A', 'V', 'R', 'n') },
486 { CODEC_ID_MJPEG, MKTAG('A', 'C', 'D', 'V') },
487 { CODEC_ID_MJPEG, MKTAG('Q', 'I', 'V', 'G') },
488 { CODEC_ID_MJPEG, MKTAG('S', 'L', 'M', 'J') }, /* SL M-JPEG */
489 { CODEC_ID_MJPEG, MKTAG('C', 'J', 'P', 'G') }, /* Creative Webcam JPEG */
490 { CODEC_ID_MJPEG, MKTAG('I', 'J', 'L', 'V') }, /* Intel JPEG Library Video Codec */
491 { CODEC_ID_MJPEG, MKTAG('M', 'V', 'J', 'P') }, /* Midvid JPEG Video Codec */
492 { CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '1') },
493 { CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '2') },
494 { CODEC_ID_MJPEG, MKTAG('M', 'T', 'S', 'J') },
495 { CODEC_ID_MJPEG, MKTAG('Z', 'J', 'P', 'G') }, /* Paradigm Matrix M-JPEG Codec */
496 { CODEC_ID_HUFFYUV, MKTAG('H', 'F', 'Y', 'U') },
497 { CODEC_ID_FFVHUFF, MKTAG('F', 'F', 'V', 'H') },
498 { CODEC_ID_CYUV, MKTAG('C', 'Y', 'U', 'V') },
499 { CODEC_ID_RAWVIDEO, MKTAG(0 , 0 , 0 , 0) },
500 { CODEC_ID_RAWVIDEO, MKTAG(3 , 0 , 0 , 0) },
501 { CODEC_ID_RAWVIDEO, MKTAG('I', '4', '2', '0') },
502 { CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') },
503 { CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') },
504 { CODEC_ID_RAWVIDEO, MKTAG('V', '4', '2', '2') },
505 { CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'N', 'V') },
506 { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'V') },
507 { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'Y') },
508 { CODEC_ID_RAWVIDEO, MKTAG('u', 'y', 'v', '1') },
509 { CODEC_ID_RAWVIDEO, MKTAG('2', 'V', 'u', '1') },
510 { CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') },
511 { CODEC_ID_RAWVIDEO, MKTAG('P', '4', '2', '2') },
512 { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') },
513 { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') },
514 { CODEC_ID_RAWVIDEO, MKTAG('V', 'Y', 'U', 'Y') },
515 { CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') },
516 { CODEC_ID_RAWVIDEO, MKTAG('Y', '8', '0', '0') },
517 { CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') },
518 { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') },
519 { CODEC_ID_RAWVIDEO, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */
520 { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
521 { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },
522 { CODEC_ID_INDEO4, MKTAG('I', 'V', '4', '1') },
523 { CODEC_ID_INDEO5, MKTAG('I', 'V', '5', '0') },
524 { CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },
525 { CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') },
526 { CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') },
527 { CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') },
528 { CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') },
529 { CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') },
530 { CODEC_ID_VP6F, MKTAG('V', 'P', '6', 'F') },
531 { CODEC_ID_VP6F, MKTAG('F', 'L', 'V', '4') },
532 { CODEC_ID_ASV1, MKTAG('A', 'S', 'V', '1') },
533 { CODEC_ID_ASV2, MKTAG('A', 'S', 'V', '2') },
534 { CODEC_ID_VCR1, MKTAG('V', 'C', 'R', '1') },
535 { CODEC_ID_FFV1, MKTAG('F', 'F', 'V', '1') },
536 { CODEC_ID_XAN_WC4, MKTAG('X', 'x', 'a', 'n') },
537 { CODEC_ID_MIMIC, MKTAG('L', 'M', '2', '0') },
538 { CODEC_ID_MSRLE, MKTAG('m', 'r', 'l', 'e') },
539 { CODEC_ID_MSRLE, MKTAG(1 , 0 , 0 , 0) },
540 { CODEC_ID_MSRLE, MKTAG(2 , 0 , 0 , 0) },
541 { CODEC_ID_MSVIDEO1, MKTAG('M', 'S', 'V', 'C') },
542 { CODEC_ID_MSVIDEO1, MKTAG('m', 's', 'v', 'c') },
543 { CODEC_ID_MSVIDEO1, MKTAG('C', 'R', 'A', 'M') },
544 { CODEC_ID_MSVIDEO1, MKTAG('c', 'r', 'a', 'm') },
545 { CODEC_ID_MSVIDEO1, MKTAG('W', 'H', 'A', 'M') },
546 { CODEC_ID_MSVIDEO1, MKTAG('w', 'h', 'a', 'm') },
547 { CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') },
548 { CODEC_ID_TRUEMOTION1, MKTAG('D', 'U', 'C', 'K') },
549 { CODEC_ID_TRUEMOTION1, MKTAG('P', 'V', 'E', 'Z') },
550 { CODEC_ID_MSZH, MKTAG('M', 'S', 'Z', 'H') },
551 { CODEC_ID_ZLIB, MKTAG('Z', 'L', 'I', 'B') },
552 #if FF_API_SNOW
553 { CODEC_ID_SNOW, MKTAG('S', 'N', 'O', 'W') },
554 #endif
555 { CODEC_ID_4XM, MKTAG('4', 'X', 'M', 'V') },
556 { CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1') },
557 { CODEC_ID_FLASHSV, MKTAG('F', 'S', 'V', '1') },
558 { CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') },
559 { CODEC_ID_TSCC, MKTAG('t', 's', 'c', 'c') },
560 { CODEC_ID_ULTI, MKTAG('U', 'L', 'T', 'I') },
561 { CODEC_ID_VIXL, MKTAG('V', 'I', 'X', 'L') },
562 { CODEC_ID_QPEG, MKTAG('Q', 'P', 'E', 'G') },
563 { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') },
564 { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') },
565 { CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') },
566 { CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') },
567 { CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') },
568 { CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') },
569 { CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') },
570 { CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') },
571 { CODEC_ID_INDEO2, MKTAG('R', 'T', '2', '1') },
572 { CODEC_ID_FRAPS, MKTAG('F', 'P', 'S', '1') },
573 { CODEC_ID_THEORA, MKTAG('t', 'h', 'e', 'o') },
574 { CODEC_ID_TRUEMOTION2, MKTAG('T', 'M', '2', '0') },
575 { CODEC_ID_CSCD, MKTAG('C', 'S', 'C', 'D') },
576 { CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') },
577 { CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') },
578 { CODEC_ID_CAVS, MKTAG('C', 'A', 'V', 'S') },
579 { CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
580 { CODEC_ID_VMNC, MKTAG('V', 'M', 'n', 'c') },
581 { CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') },
582 { CODEC_ID_PNG, MKTAG('M', 'P', 'N', 'G') },
583 { CODEC_ID_PNG, MKTAG('P', 'N', 'G', '1') },
584 { CODEC_ID_CLJR, MKTAG('c', 'l', 'j', 'r') },
585 { CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
586 { CODEC_ID_RPZA, MKTAG('a', 'z', 'p', 'r') },
587 { CODEC_ID_RPZA, MKTAG('R', 'P', 'Z', 'A') },
588 { CODEC_ID_RPZA, MKTAG('r', 'p', 'z', 'a') },
589 { CODEC_ID_SP5X, MKTAG('S', 'P', '5', '4') },
590 { CODEC_ID_NONE, 0 }
591 };
592
593
594 #ifndef __WEED_PALETTES_H__
595 #include <weed/weed-palettes.h>
596 #endif
597
598 int avi_pix_fmt_to_weed_palette(enum PixelFormat pix_fmt, int *clamped) {
599 // clamped may be set to NULL if you are not interested in the value
600
601 switch (pix_fmt) {
602 case PIX_FMT_RGB24:
603 return WEED_PALETTE_RGB24;
604 case PIX_FMT_BGR24:
605 return WEED_PALETTE_BGR24;
606 case PIX_FMT_RGBA:
607 return WEED_PALETTE_RGBA32;
608 case PIX_FMT_BGRA:
609 return WEED_PALETTE_BGRA32;
610 case PIX_FMT_ARGB:
611 return WEED_PALETTE_ARGB32;
612 case PIX_FMT_YUV444P:
613 return WEED_PALETTE_YUV444P;
614 case PIX_FMT_YUV422P:
615 return WEED_PALETTE_YUV422P;
616 case PIX_FMT_YUV420P:
617 return WEED_PALETTE_YUV420P;
618 case PIX_FMT_YUYV422:
619 return WEED_PALETTE_YUYV;
620 case PIX_FMT_UYVY422:
621 return WEED_PALETTE_UYVY;
622 case PIX_FMT_UYYVYY411:
623 return WEED_PALETTE_YUV411;
624 case PIX_FMT_GRAY8:
625 return WEED_PALETTE_A8;
626 case PIX_FMT_MONOWHITE:
627 case PIX_FMT_MONOBLACK:
628 return WEED_PALETTE_A1;
629 case PIX_FMT_YUVJ422P:
630 if (clamped) *clamped=WEED_YUV_CLAMPING_UNCLAMPED;
631 return WEED_PALETTE_YUV422P;
632 case PIX_FMT_YUVJ444P:
633 if (clamped) *clamped=WEED_YUV_CLAMPING_UNCLAMPED;
634 return WEED_PALETTE_YUV444P;
635 case PIX_FMT_YUVJ420P:
636 if (clamped) *clamped=WEED_YUV_CLAMPING_UNCLAMPED;
637 return WEED_PALETTE_YUV420P;
638
639 default:
640 return WEED_PALETTE_END;
641 }
642 }
643
644
645
646
647 enum PixelFormat weed_palette_to_avi_pix_fmt(int pal, int *clamped) {
648
649 switch (pal) {
650 case WEED_PALETTE_RGB24:
651 return PIX_FMT_RGB24;
652 case WEED_PALETTE_BGR24:
653 return PIX_FMT_BGR24;
654 case WEED_PALETTE_RGBA32:
655 return PIX_FMT_RGBA;
656 case WEED_PALETTE_BGRA32:
657 return PIX_FMT_BGRA;
658 case WEED_PALETTE_ARGB32:
659 return PIX_FMT_ARGB;
660 case WEED_PALETTE_YUV444P:
661 if (clamped && *clamped==WEED_YUV_CLAMPING_UNCLAMPED)
662 return PIX_FMT_YUVJ444P;
663 return PIX_FMT_YUV444P;
664 case WEED_PALETTE_YUV422P:
665 if (clamped && *clamped==WEED_YUV_CLAMPING_UNCLAMPED)
666 return PIX_FMT_YUVJ422P;
667 return PIX_FMT_YUV422P;
668 case WEED_PALETTE_YUV420P:
669 if (clamped && *clamped==WEED_YUV_CLAMPING_UNCLAMPED)
670 return PIX_FMT_YUVJ420P;
671 return PIX_FMT_YUV420P;
672 case WEED_PALETTE_YUYV:
673 return PIX_FMT_YUYV422;
674 case WEED_PALETTE_UYVY:
675 return PIX_FMT_UYVY422;
676 case WEED_PALETTE_YUV411:
677 return PIX_FMT_UYYVYY411;
678
679 case WEED_PALETTE_A8:
680 return PIX_FMT_GRAY8;
681 case WEED_PALETTE_A1:
682 return PIX_FMT_MONOBLACK;
683
684 default:
685 return PIX_FMT_NONE;
686 }
687
688 return PIX_FMT_NONE;
689
690 }
691
692 #endif // HAVE_AVUTIL
693 #endif // HAVE_AVCODEC
694
695 #ifdef __cplusplus
696 }
697 #endif /* __cplusplus */
698
699 #endif // #ifndef __WEED_COMPAT_H__
WEED_PALETTE_YUV420P
#define WEED_PALETTE_YUV420P
Definition: weed-palettes.h:76
WEED_PALETTE_YUV888
#define WEED_PALETTE_YUV888
Definition: weed-palettes.h:90
WEED_PALETTE_A8
#define WEED_PALETTE_A8
Definition: weed-palettes.h:96
WEED_YUV_SUBSPACE_BT709
#define WEED_YUV_SUBSPACE_BT709
Definition: weed-palettes.h:115
WEED_PALETTE_YUV411
#define WEED_PALETTE_YUV411
Definition: weed-palettes.h:88
WEED_PALETTE_A1
#define WEED_PALETTE_A1
Definition: weed-palettes.h:95
WEED_PALETTE_YUV444P
#define WEED_PALETTE_YUV444P
Definition: weed-palettes.h:81
WEED_YUV_CLAMPING_CLAMPED
#define WEED_YUV_CLAMPING_CLAMPED
Definition: weed-palettes.h:109
WEED_PALETTE_UYVY
#define WEED_PALETTE_UYVY
Definition: weed-palettes.h:87
WEED_PALETTE_END
#define WEED_PALETTE_END
Definition: weed-palettes.h:59
WEED_PALETTE_YUV422P
#define WEED_PALETTE_YUV422P
Definition: weed-palettes.h:74
WEED_PALETTE_BGRA32
#define WEED_PALETTE_BGRA32
Definition: weed-palettes.h:71
WEED_PALETTE_RGBA32
#define WEED_PALETTE_RGBA32
Definition: weed-palettes.h:65
WEED_YUV_CLAMPING_UNCLAMPED
#define WEED_YUV_CLAMPING_UNCLAMPED
Definition: weed-palettes.h:110
WEED_PALETTE_ARGB32
#define WEED_PALETTE_ARGB32
Definition: weed-palettes.h:67
WEED_PALETTE_BGR24
#define WEED_PALETTE_BGR24
Definition: weed-palettes.h:63
WEED_YUV_SAMPLING_DEFAULT
#define WEED_YUV_SAMPLING_DEFAULT
Definition: weed-palettes.h:102
WEED_PALETTE_YUYV
#define WEED_PALETTE_YUYV
Definition: weed-palettes.h:84
WEED_PALETTE_YVU420P
#define WEED_PALETTE_YVU420P
Definition: weed-palettes.h:78
weed-palettes.h
WEED_PALETTE_YUVA4444P
#define WEED_PALETTE_YUVA4444P
Definition: weed-palettes.h:82
WEED_PALETTE_RGB24
#define WEED_PALETTE_RGB24
Definition: weed-palettes.h:61
WEED_YUV_SUBSPACE_YCBCR
#define WEED_YUV_SUBSPACE_YCBCR
Definition: weed-palettes.h:114