]> git.sesse.net Git - vlc/blob - modules/video_filter/atmo/AtmoDefs.h
Use var_InheritString for --decklink-video-connection.
[vlc] / modules / video_filter / atmo / AtmoDefs.h
1 /*
2  * AtmoDefs.h: a lot of globals defines for the color computation - most of this file
3  * is an one  to one copy of "defs.h" from Atmo VDR Plugin
4  *
5  * See the README.txt file for copyright information and how to reach the author(s).
6  *
7  * $Id$
8  */
9
10 #ifndef _AtmoDefs_h_
11 #define _AtmoDefs_h_
12
13
14 #if defined(__LIBVLC__)
15
16 #   include "config.h"
17 #   include <vlc_common.h>
18
19 /* some things need to be changed if this code is used inside VideoLan Filter Module */
20 #   define _ATMO_VLC_PLUGIN_
21 #   define get_time mdate()
22 #   define do_sleep(a) msleep(a)
23
24 #else
25
26 #   define MakeDword(ch1,ch2,ch3,ch4) ((((DWORD)(ch1)&255) << 24) | \
27                                    (((DWORD)(ch2)&255) << 16) | \
28                                    (((DWORD)(ch3)&255) << 8) | \
29                                    (((DWORD)(ch4)&255)))
30
31 #  define get_time GetTickCount()
32 #  define do_sleep(a) Sleep(a)
33
34 #endif
35
36 #define ATMO_BOOL   bool
37 #define ATMO_TRUE   true
38 #define ATMO_FALSE  false
39
40
41 /*
42   can't use the VLC_TWOCC macro because the byte order there is CPU dependent
43   but for the use in Atmo I need for this single purpose Intel Byte Order
44   every time!
45 */
46
47 #define MakeIntelWord(ch1,ch2)  ((((int)(ch1)&255)<<8) | \
48                            ((int)(ch2)&255))
49
50 // my own min max macros
51 #define ATMO_MIN(X, Y)  ((X) < (Y) ? (X) : (Y))
52 #define ATMO_MAX(X, Y)  ((X) > (Y) ? (X) : (Y))
53
54
55 #if !defined(WIN32)
56
57 #define INVALID_HANDLE_VALUE -1
58 typedef int HANDLE;
59 typedef unsigned long DWORD;
60
61 #define BI_RGB 0L
62
63 #if !defined(_BITMAPFILEHEADER_)
64 #define _BITMAPFILEHEADER_
65 typedef struct
66 #ifdef HAVE_ATTRIBUTE_PACKED
67     __attribute__((__packed__))
68 #endif
69 {
70         uint16_t   bfType;
71         uint32_t   bfSize;
72         uint16_t   bfReserved1;
73         uint16_t   bfReserved2;
74         uint32_t   bfOffBits;
75 } BITMAPFILEHEADER, *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER;
76 #endif
77
78 #endif
79
80
81
82 // maximal Anzahl Kanäle... original 5!
83 #define CAP_MAX_NUM_ZONES  64
84 // only for classic to avoid changing too much code!
85 // #define ATMO_MAX_NUM_CHANNELS 5
86
87 // capture width/height
88
89 // #define CAP_WIDTH    88
90
91 #ifdef CAP_16x9
92 # define CAP_WIDTH    88
93 # define CAP_HEIGHT   48
94 #else
95 # define CAP_WIDTH    64
96 # define CAP_HEIGHT   48
97 #endif
98
99 // imagesize
100 #define IMAGE_SIZE   (CAP_WIDTH * CAP_HEIGHT)
101
102 /*
103   number of pixel the atmo zones should overlap - based on CAP_WIDTH and CAP_HEIGHT
104 */
105 #define CAP_ZONE_OVERLAP  2
106
107
108
109 enum AtmoConnectionType
110 {
111       actClassicAtmo = 0,
112       actDummy = 1,
113       actDMX = 2,
114       actNUL = 3,
115       actMultiAtmo = 4,
116       actMondolight = 5,
117       actMoMoLight = 6,
118       actFnordlicht = 7
119 };
120 static const char *AtmoDeviceTypes[] = {
121       "Atmo-Classic",
122       "Dummy",
123       "DMX",
124       "Nul-Device",
125       "Multi-Atmo",
126       "Mondolight",
127       "MoMoLight",
128       "Fnordlicht"
129   };
130 #define ATMO_DEVICE_COUNT 8
131
132 #if defined(_ATMO_VLC_PLUGIN_)
133 enum EffectMode {
134       emUndefined = -1,
135       emDisabled = 0,
136       emStaticColor = 1,
137       emLivePicture = 2
138    };
139
140 enum LivePictureSource {
141        lpsDisabled = 0,
142        lpsExtern = 2
143      };
144
145 #else
146
147 enum EffectMode {
148       emUndefined = -1,
149       emDisabled = 0,
150       emStaticColor = 1,
151       emLivePicture = 2,
152       emColorChange = 3,
153       emLrColorChange = 4
154    };
155
156 enum LivePictureSource {
157        lpsDisabled = 0,
158        lpsScreenCapture = 1,
159        lpsExtern = 2
160      };
161
162 #endif
163
164 enum AtmoGammaCorrect {
165      agcNone = 0,
166      agcPerColor = 1,
167      agcGlobal = 2
168 };
169
170 enum AtmoFilterMode {
171      afmNoFilter,
172      afmCombined,
173      afmPercent
174 };
175
176
177 // --- tRGBColor --------------------------------------------------------------
178 typedef struct
179 {
180   unsigned char r, g, b;
181 } tRGBColor;
182
183 // --- tColorPacket -----------------------------------------------------------
184 typedef struct
185 {
186    int numColors;
187    tRGBColor zone[1];
188 } xColorPacket;
189 typedef xColorPacket* pColorPacket;
190 #define AllocColorPacket(packet, numColors_) packet = (pColorPacket)new char[sizeof(xColorPacket) + (numColors_)*sizeof(tRGBColor)]; \
191                                              packet->numColors = numColors_;
192
193 #define DupColorPacket(dest, source) dest = NULL; \
194                                      if(source) { \
195                                          dest = (pColorPacket)new char[sizeof(xColorPacket) + (source->numColors)*sizeof(tRGBColor)]; \
196                                          memcpy(dest, source, sizeof(xColorPacket) + (source->numColors)*sizeof(tRGBColor)); \
197                                      }
198
199 #define CopyColorPacket( source, dest)  memcpy(dest, source, sizeof(xColorPacket) + (source->numColors)*sizeof(tRGBColor) );
200
201
202 #define ZeroColorPacket( packet ) memset( &((packet)->zone[0]), 0, (packet->numColors)*sizeof(tRGBColor));
203
204 // --- tRGBColorLongInt -------------------------------------------------------
205 typedef struct
206 {
207   long int r, g, b;
208 } tRGBColorLongInt;
209
210 // --- tColorPacketLongInt ----------------------------------------------------
211 typedef struct
212 {
213   int numColors;
214   tRGBColorLongInt longZone[1];
215 } xColorPacketLongInt;
216 typedef xColorPacketLongInt* pColorPacketLongInt;
217 #define AllocLongColorPacket(packet, numColors_) packet = (pColorPacketLongInt)new char[sizeof(xColorPacketLongInt) + (numColors_)*sizeof(tRGBColorLongInt)]; \
218                                              packet->numColors = numColors_;
219
220 #define DupLongColorPacket(dest, source) dest = NULL; \
221                                      if(source) { \
222                                          dest = (pColorPacketLongInt)new char[sizeof(xColorPacketLongInt) + (source->numColors)*sizeof(tRGBColorLongInt)]; \
223                                          memcpy(dest, source, sizeof(xColorPacketLongInt) + (source->numColors)*sizeof(tRGBColorLongInt)); \
224                                      }
225 #define ZeroLongColorPacket( packet ) memset( &((packet)->longZone[0]), 0, (packet->numColors)*sizeof(tRGBColorLongInt));
226
227
228 // --- tWeightPacket ----------------------------------------------------------
229 /*
230 typedef struct
231 {
232   int channel[CAP_MAX_NUM_ZONES];
233 } tWeightPacket;
234 */
235
236 // --- tHSVColor --------------------------------------------------------------
237 typedef struct
238 {
239   unsigned char h, s, v;
240 } tHSVColor;
241
242 #endif