1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2013 Academy of Motion Picture Arts and Sciences
3 // ("A.M.P.A.S."). Portions contributed by others as indicated.
4 // All rights reserved.
5 //
6 // A worldwide, royalty-free, non-exclusive right to copy, modify, create
7 // derivatives, and use, in source and binary forms, is hereby granted,
8 // subject to acceptance of this license. Performance of any of the
9 // aforementioned acts indicates acceptance to be bound by the following
10 // terms and conditions:
11 //
12 //  * Copies of source code, in whole or in part, must retain the
13 //    above copyright notice, this list of conditions and the
14 //    Disclaimer of Warranty.
15 //
16 //  * Use in binary form must retain the above copyright notice,
17 //    this list of conditions and the Disclaimer of Warranty in the
18 //    documentation and/or other materials provided with the distribution.
19 //
20 //  * Nothing in this license shall be deemed to grant any rights to
21 //    trademarks, copyrights, patents, trade secrets or any other
22 //    intellectual property of A.M.P.A.S. or any contributors, except
23 //    as expressly stated herein.
24 //
25 //  * Neither the name "A.M.P.A.S." nor the name of any other
26 //    contributors to this software may be used to endorse or promote
27 //    products derivative of or based on this software without express
28 //    prior written permission of A.M.P.A.S. or the contributors, as
29 //    appropriate.
30 //
31 // This license shall be construed pursuant to the laws of the State of
32 // California, and any disputes related thereto shall be subject to the
33 // jurisdiction of the courts therein.
34 //
35 // Disclaimer of Warranty: THIS SOFTWARE IS PROVIDED BY A.M.P.A.S. AND
36 // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
37 // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
38 // FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO
39 // EVENT SHALL A.M.P.A.S., OR ANY CONTRIBUTORS OR DISTRIBUTORS, BE LIABLE
40 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, RESITUTIONARY,
41 // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
46 // THE POSSIBILITY OF SUCH DAMAGE.
47 //
48 // WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE ACADEMY
49 // SPECIFICALLY DISCLAIMS ANY REPRESENTATIONS OR WARRANTIES WHATSOEVER
50 // RELATED TO PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS IN THE ACADEMY
51 // COLOR ENCODING SYSTEM, OR APPLICATIONS THEREOF, HELD BY PARTIES OTHER
52 // THAN A.M.P.A.S., WHETHER DISCLOSED OR UNDISCLOSED.
53 ///////////////////////////////////////////////////////////////////////////
54 
55 
56 #ifndef INCLUDED_CTL_SIMD_STD_TYPES_H
57 #define INCLUDED_CTL_SIMD_STD_TYPES_H
58 
59 //-----------------------------------------------------------------------------
60 //
61 //	A class that generates the function and data types needed
62 //	for the SIMD version of the CTL standard library.
63 //
64 //-----------------------------------------------------------------------------
65 
66 #include <CtlType.h>
67 
68 namespace Ctl {
69 
70 class SymbolTable;
71 
72 class SimdStdTypes
73 {
74   public:
75 
76      SimdStdTypes (LContext &lcontext);
77     ~SimdStdTypes ();
78 
79     DataTypePtr 	type_v ();		// void
80 
81     DataTypePtr 	type_b ();		// bool
82 
83     DataTypePtr 	type_i ();		// int
84 
85     DataTypePtr		type_ui ();		// unsigned int
86 
87     DataTypePtr		type_h ();		// unsigned int
88 
89     DataTypePtr		type_f ();		// float
90 
91     DataTypePtr		type_s ();		// string
92 
93     DataTypePtr		type_i2 ();		// int[2]
94 
95     DataTypePtr		type_f2 ();		// float[2]
96 
97     DataTypePtr		type_f3 ();		// float[3]
98 
99     DataTypePtr		type_f33 ();		// float[3][3]
100 
101     DataTypePtr		type_f44 ();		// float[4][4]
102 
103     DataTypePtr		type_box2i ();		// struct Box2i
104 						// {
105 						//     int min[2];
106 						//     int max[2];
107 						// };
108 
109     DataTypePtr		type_box2f ();		// struct Box2f
110 						// {
111 						//     float min[2];
112 						//     float max[2];
113 						// };
114 
115     DataTypePtr		type_chr ();		// struct Chromaticities
116 						// {
117 						//     float red[2];
118 						//     float green[2];
119 						//     float blue[2];
120 						//     float white[2];
121 						// };
122 
123     FunctionTypePtr	funcType_v_b ();	// void func (bool)
124 
125     FunctionTypePtr	funcType_v_i ();	// void func (int)
126 
127     FunctionTypePtr	funcType_v_ui ();	// void func (unsigned int)
128 
129     FunctionTypePtr	funcType_v_h ();	// void func (half)
130 
131     FunctionTypePtr	funcType_v_f ();	// void func (float)
132 
133     FunctionTypePtr	funcType_v_s ();	// void func (string)
134 
135     FunctionTypePtr	funcType_b_h ();	// bool func (half)
136 
137     FunctionTypePtr	funcType_b_f ();	// bool func (float)
138 
139     FunctionTypePtr	funcType_f_f ();	// float func (float)
140 
141     FunctionTypePtr	funcType_h_f ();	// half func (float)
142 
143     FunctionTypePtr	funcType_f_h ();	// float func (half)
144 
145     FunctionTypePtr	funcType_f_f_f ();	// float func (float, float)
146 
147     FunctionTypePtr	funcType_h_h_f ();	// half func (half, float)
148 
149     FunctionTypePtr	funcType_f33_f33 ();	// float[3][3] func
150 						//	(float[3][3])
151 
152     FunctionTypePtr	funcType_f44_f44 ();	// float[4][4] func
153 						//	(float[4][4])
154 
155     FunctionTypePtr	funcType_f33_f33_f33 ();// float[3][3] func
156     						//	(float[3][3],
157 						//	 float[3][3])
158 
159     FunctionTypePtr	funcType_f44_f44_f44 ();// float[4][4] func
160     						//	(float[4][4],
161 						//	 float[4][4])
162 
163     FunctionTypePtr	funcType_f33_f_f33 ();	// float[3][3] func
164     						//	(float,
165 						//	 float[3][3])
166 
167     FunctionTypePtr	funcType_f44_f_f44 ();	// float[4][4] func
168     						//	(float,
169 						//	 float[4][4])
170 
171     FunctionTypePtr	funcType_f3_f3_f44 ();	// float[3] func
172     						//	(float[3],
173 						//	 float[4][4])
174 
175     FunctionTypePtr	funcType_f3_f3_f33 ();	// float[3] func
176     						//	(float[3],
177 						//	 float[3][3])
178 
179     FunctionTypePtr	funcType_f3_f3_f3 ();	// float[3] func
180     						//	(float[3],
181 						//	 float[3])
182 
183     FunctionTypePtr	funcType_f3_f_f3 ();	// float[3] func
184     						//	(float,
185 						//	 float[3])
186 
187     FunctionTypePtr	funcType_f_f3_f3 ();	// float func
188     						//	(float[3],
189 						//	 float[3])
190 
191     FunctionTypePtr	funcType_f_f3 ();	// float func (float[3])
192 
193     FunctionTypePtr	funcType_f44_chr_f ();	// float func
194     						//	(Chromaticities,
195 						//	 float)
196 
197     FunctionTypePtr	funcType_f_f0_f_f_f ();	// float func
198     						//	(float[],
199 						//	 float,
200 						//	 float,
201 						//	 float)
202 
203     FunctionTypePtr	funcType_f_f02_f ();	// float func
204     						//	(float[][2],
205 						//	 float)
206 
207     FunctionTypePtr	funcType_f3_f0003_f3_f3_f3 ();
208 						// float[3] func
209 						//	(float[][][][3],
210 						//	 float[3],
211 						//	 float[3],
212 						//	 float[3])
213 
214     FunctionTypePtr	funcType_v_f0003_f3_f3_fff_offf ();
215 						// void func
216 						//	(float[][][][3],
217 						//	 float[3],
218 						//	 float[3],
219 						//	 float,
220 						//	 float,
221 						//	 float,
222 						//	 output float,
223 						//	 output float,
224 						//	 output float)
225 
226     FunctionTypePtr	funcType_v_f0003_f3_f3_hhh_ohhh ();
227 						// void func
228 						//	(float[][][][3],
229 						//	 float[3],
230 						//	 float[3],
231 						//	 half,
232 						//	 half,
233 						//	 half,
234 						//	 output half,
235 						//	 output half,
236 						//	 output half)
237 
238     FunctionTypePtr	funcType_v_f023_f3_f3_of0003 ();
239 						// void func
240 						//	(float[][2][3],
241 						//	 float[3],
242 						//	 float[3],
243 						//	 output float[][][][3])
244   private:
245 
246     LContext &		_lcontext;
247 
248     DataTypePtr		_type_i2;
249     DataTypePtr		_type_f2;
250     DataTypePtr		_type_f3;
251     DataTypePtr		_type_f33;
252     DataTypePtr		_type_f44;
253     DataTypePtr		_type_box2i;
254     DataTypePtr		_type_box2f;
255     DataTypePtr		_type_chr;
256     FunctionTypePtr	_funcType_v_b;
257     FunctionTypePtr	_funcType_v_i;
258     FunctionTypePtr	_funcType_v_ui;
259     FunctionTypePtr	_funcType_v_h;
260     FunctionTypePtr	_funcType_v_f;
261     FunctionTypePtr	_funcType_v_s;
262     FunctionTypePtr	_funcType_b_h;
263     FunctionTypePtr	_funcType_b_f;
264     FunctionTypePtr	_funcType_f_f;
265     FunctionTypePtr	_funcType_h_f;
266     FunctionTypePtr	_funcType_f_h;
267     FunctionTypePtr	_funcType_f_f_f;
268     FunctionTypePtr	_funcType_h_h_f;
269     FunctionTypePtr	_funcType_f33_f33;
270     FunctionTypePtr	_funcType_f44_f44;
271     FunctionTypePtr	_funcType_f33_f33_f33;
272     FunctionTypePtr	_funcType_f44_f44_f44;
273     FunctionTypePtr	_funcType_f33_f_f33;
274     FunctionTypePtr	_funcType_f44_f_f44;
275     FunctionTypePtr	_funcType_f3_f3_f33;
276     FunctionTypePtr	_funcType_f3_f3_f44;
277     FunctionTypePtr	_funcType_f3_f3_f3;
278     FunctionTypePtr	_funcType_f3_f_f3;
279     FunctionTypePtr	_funcType_f_f3_f3;
280     FunctionTypePtr	_funcType_f_f3;
281     FunctionTypePtr	_funcType_f44_chr_f;
282     FunctionTypePtr	_funcType_f_f0_f_f_f;
283     FunctionTypePtr	_funcType_f_f02_f;
284     FunctionTypePtr	_funcType_f3_f0003_f3_f3_f3;
285     FunctionTypePtr	_funcType_v_f0003_f3_f3_fff_offf;
286     FunctionTypePtr	_funcType_v_f0003_f3_f3_hhh_ohhh;
287     FunctionTypePtr	_funcType_v_f023_f3_f3_of0003;
288 };
289 
290 
291 } // namespace Ctl
292 
293 #endif
294