]> git.sesse.net Git - vlc/blob - modules/video_filter/swscale/common.h
mkv.cpp: store silent tracks info
[vlc] / modules / video_filter / swscale / common.h
1 /*****************************************************************************
2  * common.h: a few defines and wrappers for swscale
3  *****************************************************************************
4  * Copyright (C) 1999-2004 VideoLAN
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #define mp_msg(a,b,args... ) //fprintf(stderr, ##args)
25 #define vo_format_name(a) ""
26
27 #ifndef _VLC_FILTER_H
28 extern void *( *swscale_fast_memcpy )( void *, const void *, int );
29 #endif
30 #define memcpy(a,b,c) swscale_fast_memcpy(a,b,c)
31
32 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__OS2__) || \
33    (defined(__OpenBSD__) && !defined(__ELF__))
34 #define MANGLE(a) "_" #a
35 #else
36 #define MANGLE(a) #a
37 #endif
38
39 #ifdef ARCH_X86
40 static inline unsigned short ByteSwap16(unsigned short x)
41 {
42   __asm("xchgb %b0,%h0" :
43         "=q" (x)        :
44         "0" (x));
45     return x;
46 }
47 #define bswap_16(x) ByteSwap16(x)
48 #else
49
50 #define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8)
51 #endif  /* !ARCH_X86 */
52
53 /* SWSCALE image formats */
54 #define IMGFMT_RGB_MASK 0xFFFFFF00
55 #define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8))
56 #define IMGFMT_RGB1  (IMGFMT_RGB|1)
57 #define IMGFMT_RGB4  (IMGFMT_RGB|4)
58 #define IMGFMT_RGB4_CHAR  (IMGFMT_RGB|4|128) // RGB4 with 1 pixel per byte
59 #define IMGFMT_RGB8  (IMGFMT_RGB|8)
60 #define IMGFMT_RGB15 (IMGFMT_RGB|15)
61 #define IMGFMT_RGB16 (IMGFMT_RGB|16)
62 #define IMGFMT_RGB24 (IMGFMT_RGB|24)
63 #define IMGFMT_RGB32 (IMGFMT_RGB|32)
64
65 #define IMGFMT_BGR_MASK 0xFFFFFF00
66 #define IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8))
67 #define IMGFMT_BGR1 (IMGFMT_BGR|1)
68 #define IMGFMT_BGR4 (IMGFMT_BGR|4)
69 #define IMGFMT_BGR4_CHAR (IMGFMT_BGR|4|128) // BGR4 with 1 pixel per byte
70 #define IMGFMT_BGR8 (IMGFMT_BGR|8)
71 #define IMGFMT_BGR15 (IMGFMT_BGR|15)
72 #define IMGFMT_BGR16 (IMGFMT_BGR|16)
73 #define IMGFMT_BGR24 (IMGFMT_BGR|24)
74 #define IMGFMT_BGR32 (IMGFMT_BGR|32)
75
76 #ifdef WORDS_BIGENDIAN
77 #define IMGFMT_ABGR IMGFMT_RGB32
78 #define IMGFMT_BGRA (IMGFMT_RGB32|64)
79 #define IMGFMT_ARGB IMGFMT_BGR32
80 #define IMGFMT_RGBA (IMGFMT_BGR32|64)
81 #else
82 #define IMGFMT_ABGR (IMGFMT_BGR32|64)
83 #define IMGFMT_BGRA IMGFMT_BGR32
84 #define IMGFMT_ARGB (IMGFMT_RGB32|64)
85 #define IMGFMT_RGBA IMGFMT_RGB32
86 #endif
87
88 /* old names for compatibility */
89 #define IMGFMT_RG4B  IMGFMT_RGB4_CHAR
90 #define IMGFMT_BG4B  IMGFMT_BGR4_CHAR
91
92 #define IMGFMT_IS_RGB(fmt) (((fmt)&IMGFMT_RGB_MASK)==IMGFMT_RGB)
93 #define IMGFMT_IS_BGR(fmt) (((fmt)&IMGFMT_BGR_MASK)==IMGFMT_BGR)
94
95 #define IMGFMT_RGB_DEPTH(fmt) ((fmt)&0x3F)
96 #define IMGFMT_BGR_DEPTH(fmt) ((fmt)&0x3F)
97
98 /* Planar YUV Formats */
99 #define IMGFMT_YVU9 0x39555659
100 #define IMGFMT_IF09 0x39304649
101 #define IMGFMT_YV12 0x32315659
102 #define IMGFMT_I420 0x30323449
103 #define IMGFMT_IYUV 0x56555949
104 #define IMGFMT_CLPL 0x4C504C43
105 #define IMGFMT_Y800 0x30303859
106 #define IMGFMT_Y8   0x20203859
107 #define IMGFMT_NV12 0x3231564E
108 #define IMGFMT_NV21 0x3132564E
109
110 /* unofficial Planar Formats, FIXME if official 4CC exists */
111 #define IMGFMT_444P 0x50343434
112 #define IMGFMT_422P 0x50323234
113 #define IMGFMT_411P 0x50313134
114 #define IMGFMT_HM12 0x32314D48
115
116 /* Packed YUV Formats */
117 #define IMGFMT_IUYV 0x56595549
118 #define IMGFMT_IY41 0x31435949
119 #define IMGFMT_IYU1 0x31555949
120 #define IMGFMT_IYU2 0x32555949
121 #define IMGFMT_UYVY 0x59565955
122 #define IMGFMT_UYNV 0x564E5955
123 #define IMGFMT_cyuv 0x76757963
124 #define IMGFMT_Y422 0x32323459
125 #define IMGFMT_YUY2 0x32595559
126 #define IMGFMT_YUNV 0x564E5559
127 #define IMGFMT_YVYU 0x55595659
128 #define IMGFMT_Y41P 0x50313459
129 #define IMGFMT_Y211 0x31313259
130 #define IMGFMT_Y41T 0x54313459
131 #define IMGFMT_Y42T 0x54323459
132 #define IMGFMT_V422 0x32323456
133 #define IMGFMT_V655 0x35353656
134 #define IMGFMT_CLJR 0x524A4C43
135 #define IMGFMT_YUVP 0x50565559
136 #define IMGFMT_UYVP 0x50565955