1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
/*-----------------------------------------------------------------
LOG
GEM - Graphics Environment for Multimedia
An object which accepts two pixes.
Copyright (c) 1997-1999 Mark Danks. mark@danks.org
Copyright (c) Günther Geiger. geiger@epy.co.at
Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
Copyright (c) 2002 James Tittle & Chris Clepper
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
-----------------------------------------------------------------*/
#ifndef INCLUDE_GEMPIXDUALOBJ_H_
#define INCLUDE_GEMPIXDUALOBJ_H_
#define NEW_DUAL_PIX
#include "Base/GemPixObj.h"
/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
GemPixDualObj
An object which accepts two pixes.
DESCRIPTION
Inlet for a gem - "gem_right"
"gem_right" - The second gem list
-----------------------------------------------------------------*/
class GEM_EXTERN GemPixDualObj : public GemPixObj
{
public:
//////////
// Constructor
GemPixDualObj();
protected:
//////////
// Destructor
virtual ~GemPixDualObj();
void render(GemState *state);
//////////
// Derived classes should NOT override this!
// This makes sure that the images are the same size.
// This calls the other process functions based on the input images.
virtual void processImage(imageStruct &image);
#ifndef NEW_DUAL_PIX
//////////
// The derived class HAS override this.
// This is called whenever a new image comes through and
// both of the image structs are RGBA
virtual void processDualImage(imageStruct &image, imageStruct &right) = 0;
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and both
// of the image structs are gray8.
// The default behavior is to output an error.
virtual void processDualGray(imageStruct &image, imageStruct &right);
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and
// the left image is an RGBA while the right is a gray8.
// The default behavior is to output an error.
virtual void processRightGray(imageStruct &image, imageStruct &right);
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and
// the left image is a gray8, the right is an RGBA
// The default behavior is to output an error.
virtual void processLeftGray(imageStruct &image, imageStruct &right);
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and both
// of the image structs are YUV.
// The default behavior is to output an error.
virtual void processDualYUV(imageStruct &image, imageStruct &right);
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and
// the left image is an RGBA while the right is a YUV.
// The default behavior is to output an error.
virtual void processRightYUV(imageStruct &image, imageStruct &right);
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and
// the left image is a YUV, the right is an RGBA
// The default behavior is to output an error.
virtual void processLeftYUV(imageStruct &image, imageStruct &right);
#else
//////////
// The derived class SHOULD override this, if it provides a method for "all" formats
virtual void processDualImage(imageStruct &left, imageStruct &right);
// Here come the more specific dual-processors
// The derived class SHOULD override these as needed
/* for simplicity this is done via preprocessor defines:
* the functions defined are like :
** processRGBA_RGBA(left, right);
*/
#define PROCESS_DUALIMAGE(CS1, CS2) \
virtual void process##CS1 ##_##CS2 (imageStruct &left, imageStruct &right){processDualImage(left, right);}
PROCESS_DUALIMAGE(RGBA, RGBA);
PROCESS_DUALIMAGE(RGBA, Gray);
PROCESS_DUALIMAGE(RGBA, YUV );
PROCESS_DUALIMAGE(Gray, RGBA);
PROCESS_DUALIMAGE(Gray, Gray);
PROCESS_DUALIMAGE(Gray, YUV );
PROCESS_DUALIMAGE(YUV, RGBA);
PROCESS_DUALIMAGE(YUV, Gray);
PROCESS_DUALIMAGE(YUV, YUV );
#undef PROCESS_DUALIMAGE
/* for simplicity this is done via preprocessor defines:
* the functions defined are like :
** processRGBA_Altivec(left, right);
*/
#define PROCESS_DUALIMAGE_SIMD(CS1, CS2,_SIMD_EXT) \
virtual void process##CS1 ##_##_SIMD_EXT (imageStruct &left, imageStruct &right){ \
process##CS1 ##_##CS2 (left, right);}
PROCESS_DUALIMAGE_SIMD(RGBA, RGBA, MMX);
PROCESS_DUALIMAGE_SIMD(RGBA, MMX , SSE2);
PROCESS_DUALIMAGE_SIMD(RGBA, RGBA, Altivec);
PROCESS_DUALIMAGE_SIMD(YUV , YUV , MMX);
PROCESS_DUALIMAGE_SIMD(YUV , MMX , SSE2);
PROCESS_DUALIMAGE_SIMD(YUV , YUV , Altivec);
PROCESS_DUALIMAGE_SIMD(Gray, Gray, MMX);
PROCESS_DUALIMAGE_SIMD(Gray, MMX , SSE2);
PROCESS_DUALIMAGE_SIMD(Gray, Gray, Altivec);
#undef PROCESS_DUALIMAGE_SIMD
#endif
//////////
virtual void postrender(GemState *);
virtual void stopRendering();
virtual void rightstopRendering() { ; }
virtual void rightRender(GemState *state);
virtual void rightPostrender(GemState *) { ; }
virtual void rightStoprender() { ; }
//////////
GemCache *m_cacheRight;
//////////
pixBlock *m_pixRight;
int m_pixRightValid;
int org_pixRightValid;
//////////
t_inlet *m_inlet;
//////////
// creation callback
static void real_obj_setupCallback(t_class *classPtr)
{ GemPixObj::real_obj_setupCallback(classPtr); GemPixDualObj::obj_setupCallback(classPtr); }
private:
static inline GemPixDualObj *GetMyClass(void *data) {return((GemPixDualObj *)((Obj_header *)data)->data);}
//////////
// Static member functions
static void obj_setupCallback(t_class *classPtr);
static void gem_rightMessCallback(void *x, t_symbol *s, int argc, t_atom *argv);
};
#endif // for header file
|