aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorTeravus Ovares2008-12-20 01:20:40 +0000
committerTeravus Ovares2008-12-20 01:20:40 +0000
commit4d26da545d8df85917b06cd603ffa6e92fd431e5 (patch)
treedec31f79c4a3d0736fd798442e090de7b951008f /OpenSim/Framework
parentRevert OpenId until we can come to grips with the mono 2 requirement (diff)
downloadopensim-SC_OLD-4d26da545d8df85917b06cd603ffa6e92fd431e5.zip
opensim-SC_OLD-4d26da545d8df85917b06cd603ffa6e92fd431e5.tar.gz
opensim-SC_OLD-4d26da545d8df85917b06cd603ffa6e92fd431e5.tar.bz2
opensim-SC_OLD-4d26da545d8df85917b06cd603ffa6e92fd431e5.tar.xz
* ReCommit the OpenID patch with a few less dependencies.
* Removes all references to ASP.NET (System.Web.UI,*) * Removes all references to System.Web.Mobile
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/OpenJpeg/bio.cs138
-rw-r--r--OpenSim/Framework/OpenJpeg/fix.cs16
-rw-r--r--OpenSim/Framework/OpenJpeg/int_.cs58
-rw-r--r--OpenSim/Framework/OpenJpeg/j2k.cs158
-rw-r--r--OpenSim/Framework/OpenJpeg/openjpeg.cs358
-rw-r--r--OpenSim/Framework/OpenJpeg/pi.cs48
6 files changed, 776 insertions, 0 deletions
diff --git a/OpenSim/Framework/OpenJpeg/bio.cs b/OpenSim/Framework/OpenJpeg/bio.cs
new file mode 100644
index 0000000..4f095ad
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/bio.cs
@@ -0,0 +1,138 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.OpenJpeg
6{
7 public static class bio
8 {
9
10 public static opj_bio bio_create()
11 {
12 opj_bio bio = new opj_bio();
13 return bio;
14 }
15
16 public static void bio_destroy(opj_bio bio)
17 {
18 // not needed on C#
19 }
20
21 public static int bio_numbytes(opj_bio bio)
22 {
23 return (bio.bp - bio.start);
24 }
25
26 public static void bio_init_enc(opj_bio bio, sbyte bp, int len)
27 {
28 bio.start = (byte)bp;
29 bio.end = (byte)(bp + (byte)len);
30 bio.bp = (byte)bp;
31 bio.buf = 0;
32 bio.ct = 8;
33 }
34
35 public static void bio_init_dec(opj_bio bio, sbyte bp, int len)
36 {
37 bio.start = (byte)bp;
38 bio.end = (byte)(bp + len);
39 bio.bp = (byte)bp;
40 bio.buf = 0;
41 bio.ct = 0;
42 }
43
44 public static void bio_write(opj_bio bio, int v, int n)
45 {
46 for (int i = n - 1; i >= 0; i--)
47 bio_putbit(bio, (v >> i) & 1);
48 }
49
50 public static int bio_read(opj_bio bio, int n)
51 {
52 int v = 0;
53 for (int i = n - 1; i >= 0; i--)
54 v += bio_getbit(bio) << i;
55
56 return v;
57 }
58
59 public static int bio_flush(opj_bio bio)
60 {
61 bio.ct = 0;
62 if (bio_byteout(bio) != 0)
63 return 1;
64
65 if (bio.ct == 7)
66 {
67 bio.ct = 0;
68 if (bio_byteout(bio) != 0)
69 return 1;
70 }
71 return 0;
72 }
73
74 public static int bio_inalign(opj_bio bio)
75 {
76 bio.ct = 0;
77 if ((bio.buf & 0xff) == 0xff)
78 {
79 if (bio_bytein(bio) != 0)
80 return 1;
81 bio.ct = 0;
82 }
83 return 0;
84 }
85
86 private static int bio_bytein(opj_bio bio)
87 {
88 bio.buf = (bio.buf << 8) & 0xffff;
89 bio.ct = bio.buf == 0xff00 ? 7 : 8;
90 if (bio.bp >= bio.end)
91 return 1;
92 bio.buf |= bio.bp++;
93
94 return 0;
95 }
96
97 private static int bio_byteout(opj_bio bio)
98 {
99 bio.buf = (bio.buf << 8) & 0xffff;
100 bio.ct = bio.buf == 0xff00 ? 7 : 8;
101 if (bio.bp >= bio.end)
102 return 1;
103
104 bio.bp = (byte)(bio.buf >> 8);
105 bio.bp++;
106 return 0;
107 }
108
109 private static void bio_putbit(opj_bio bio, int b)
110 {
111 if (bio.ct == 0)
112 bio_byteout(bio);
113
114 bio.ct--;
115 bio.buf |= (byte)(b << bio.ct);
116
117 }
118
119 private static int bio_getbit(opj_bio bio)
120 {
121 if (bio.ct == 0)
122 bio_bytein(bio);
123 bio.ct--;
124
125 return (int)((bio.buf >> bio.ct) & 1);
126 }
127
128 }
129
130 public struct opj_bio
131 {
132 public byte start;
133 public byte end;
134 public byte bp;
135 public uint buf;
136 public int ct;
137 }
138}
diff --git a/OpenSim/Framework/OpenJpeg/fix.cs b/OpenSim/Framework/OpenJpeg/fix.cs
new file mode 100644
index 0000000..76d3159
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/fix.cs
@@ -0,0 +1,16 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.OpenJpeg
6{
7 public static class fix
8 {
9 public static int fix_mul(int a, int b)
10 {
11 long temp = (long)a * (long)b;
12 temp += temp & 4096;
13 return (int)(temp >> 13);
14 }
15 }
16}
diff --git a/OpenSim/Framework/OpenJpeg/int_.cs b/OpenSim/Framework/OpenJpeg/int_.cs
new file mode 100644
index 0000000..dc71728
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/int_.cs
@@ -0,0 +1,58 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.OpenJpeg
6{
7 public static class int_
8 {
9 public static int int_min(int a, int b)
10 {
11 return a < b ? a : b;
12 }
13
14 public static int int_max(int a, int b)
15 {
16 return (a > b) ? a : b;
17 }
18
19 public static int int_clamp(int a, int min, int max)
20 {
21 if (a < min)
22 return min;
23 if (a > max)
24 return max;
25
26 return a;
27 }
28
29 public static int int_abs(int a)
30 {
31 return a < 0 ? -a : a;
32 }
33
34 public static int int_ceildiv(int a, int b)
35 {
36 return (a + b - 1) / b;
37 }
38
39 public static int int_ceildivpow2(int a, int b)
40 {
41 return (a + (1 << b) - 1) >> b;
42 }
43
44 public static int int_floordivpow2(int a, int b)
45 {
46 return a >> b;
47 }
48
49 public static int int_floorlog2(int a)
50 {
51 for (int l=0; a > 1; l++)
52 a >>= 1;
53
54 return 1;
55 }
56
57 }
58}
diff --git a/OpenSim/Framework/OpenJpeg/j2k.cs b/OpenSim/Framework/OpenJpeg/j2k.cs
new file mode 100644
index 0000000..f655364
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/j2k.cs
@@ -0,0 +1,158 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.OpenJpeg
6{
7
8 public static class j2k
9 {
10 }
11
12 public enum J2K_STATUS
13 {
14 J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */
15 J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */
16 J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */
17 J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */
18 J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */
19 J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */
20 J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */
21 J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */
22 }
23
24 public enum J2K_T2_MODE
25 {
26 THRESH_CALC = 0, /** Function called in Rate allocation process*/
27 FINAL_PASS = 1 /** Function called in Tier 2 process*/
28 }
29
30 public struct opj_stepsize
31 {
32 public int expn;
33 public int mant;
34 }
35
36 public struct opj_tccp
37 {
38 public int csty;
39 public int numresolutions;
40 public int cblkw;
41 public int cblkh;
42 public int cblksty;
43 public int qmfbid;
44 public int qntsty;
45 /// <summary>
46 /// don't forget to initialize 97 elements
47 /// </summary>
48 public opj_stepsize[] stepsizes;
49 public int numgbits;
50 public int roishift;
51 /// <summary>
52 /// Don't forget to initialize 33 elements
53 /// </summary>
54 public int[] prcw;
55
56 }
57
58 public struct opj_tcp
59 {
60 public int first;
61 public int csty;
62 public PROG_ORDER prg;
63 public int numlayers;
64 public int mct;
65 /// <summary>
66 /// don't forget to initialize to 100
67 /// </summary>
68 public float[] rates;
69 public int numpocs;
70 public int POC;
71 /// <summary>
72 /// Don't forget to initialize to 32
73 /// </summary>
74 public opj_poc[] pocs;
75 public byte ppt_data;
76 public byte ppt_data_first;
77 public int ppt;
78 public int ppt_store;
79 public int ppt_len;
80 /// <summary>
81 /// Don't forget to initialize 100 elements
82 /// </summary>
83 public float[] distoratio;
84 public opj_tccp tccps;
85
86 }
87
88 public struct opj_cp
89 {
90 public CINEMA_MODE cinema;
91 public int max_comp_size;
92 public int img_size;
93 public RSIZ_CAPABILITIES rsiz;
94 public sbyte tp_on;
95 public sbyte tp_flag;
96 public int tp_pos;
97 public int distro_alloc;
98 public int fixed_alloc;
99 public int fixed_quality;
100 public int reduce;
101 public int layer;
102 public LIMIT_DECODING limit_decoding;
103 public int tx0;
104 public int ty0;
105 public int tdx;
106 public int tdy;
107 public sbyte? comment;
108 public int tw;
109 public int th;
110 public int? tileno;
111 public byte ppm_data;
112 public byte ppm_data_first;
113 public int ppm;
114 public int ppm_store;
115 public int ppm_previous;
116 public int ppm_len;
117 public opj_tcp tcps;
118 public int matrice;
119 }
120
121 public static class j2kdefines
122 {
123 public const uint J2K_CP_CSTY_PRT = 0x01;
124 public const uint J2K_CP_CSTY_SOP = 0x02;
125 public const uint J2K_CP_CSTY_EPH = 0x04;
126 public const uint J2K_CCP_CSTY_PRT = 0x01;
127 public const uint J2K_CCP_CBLKSTY_LAZY = 0x01;
128 public const uint J2K_CCP_CBLKSTY_RESET = 0x02;
129 public const uint J2K_CCP_CBLKSTY_TERMALL = 0x04;
130 public const uint J2K_CCP_CBLKSTY_VSC = 0x08;
131 public const uint J2K_CCP_CBLKSTY_PTERM =0x10;
132 public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20;
133 public const uint J2K_CCP_QNTSTY_NOQNT = 0;
134 public const uint J2K_CCP_QNTSTY_SIQNT = 1;
135 public const uint J2K_CCP_QNTSTY_SEQNT = 2;
136
137 public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */
138 public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */
139 public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */
140 public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */
141 public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */
142 public const uint J2K_MS_COD = 0xff52; /**< COD marker value */
143 public const uint J2K_MS_COC = 0xff53; /**< COC marker value */
144 public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */
145 public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */
146 public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */
147 public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */
148 public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */
149 public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */
150 public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */
151 public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */
152 public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */
153 public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */
154 public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */
155 public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */
156 public const uint J2K_MS_COM = 0xff64; /**< COM marker value */
157 }
158}
diff --git a/OpenSim/Framework/OpenJpeg/openjpeg.cs b/OpenSim/Framework/OpenJpeg/openjpeg.cs
new file mode 100644
index 0000000..2d5e4b5
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/openjpeg.cs
@@ -0,0 +1,358 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.OpenJpeg
6{
7 public class openjpeg
8 {
9 public openjpeg()
10 {
11
12
13 }
14 }
15
16 public enum PROG_ORDER
17 {
18 PROG_UNKNOWN = -1,
19 LRCP = 0,
20 RLCP = 1,
21 RPCL = 2,
22 PCRL = 3,
23 CPRL = 4
24 }
25
26 public enum RSIZ_CAPABILITIES
27 {
28 STD_RSIZ = 0,
29 CINEMA2K = 3,
30 CINEMA4K = 4
31 }
32
33 public enum CINEMA_MODE
34 {
35 OFF = 0,
36 CINEMA2K_24 = 1,
37 CINEMA2K_48 = 2,
38 CINEMA4K_24 = 3
39 }
40
41 public enum COLOR_SPACE
42 {
43 CLRSPC_UNKNOWN = -1,
44 CLRSPC_SRGB = 1,
45 CLRSPC_GRAY = 2,
46 CLRSPC_SYCC = 3
47 }
48
49 public enum CODEC_FORMAT
50 {
51 CODEC_UNKNOWN = -1,
52 CODEC_J2K = 0,
53 CODEC_JPT = 1,
54 CODEC_JP2 = 2
55 }
56
57 public enum LIMIT_DECODING
58 {
59 NO_LIMITATION = 0,
60 LIMIT_TO_MAIN_HEADER=1,
61 DECODE_ALL_BUT_PACKETS = 2
62 }
63
64 public struct opj_poc
65 {
66 public int resno0, compno0;
67 public int layno1, resno1, compno1;
68 public int layno0, precno0, precno1;
69 public PROG_ORDER prg1, prg;
70 /// <summary>
71 /// Don't forget to initialize with 5 elements
72 /// </summary>
73 public sbyte[] progorder;
74 public int tile;
75 public int tx0, tx1, ty0, ty1;
76 public int layS, resS, copmS, prcS;
77 public int layE, resE, compE, prcE;
78 public int txS, txE, tyS, tyE, dx, dy;
79 public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t;
80 }
81
82 public struct opj_cparameters
83 {
84 public bool tile_size_on;
85 public int cp_tx0;
86 public int cp_ty0;
87 public int cp_tdx;
88 public int cp_tdy;
89 public int cp_disto_alloc;
90 public int cp_fixed_alloc;
91 public int cp_fixed_wuality;
92 public int cp_matrice;
93 public sbyte cp_comment;
94 public int csty;
95 public PROG_ORDER prog_order;
96
97 /// <summary>
98 /// Don't forget to initialize 32 elements
99 /// </summary>
100 public opj_poc[] POC;
101 public int numpocs;
102 public int tcp_numlayers;
103 /// <summary>
104 /// Don't forget to intitialize 100 elements
105 /// </summary>
106 public float[] tcp_rates;
107 /// <summary>
108 /// Don't forget to initialize 100 elements
109 /// </summary>
110 public float[] tcp_distoratio;
111 public int numresolution;
112 public int cblockw_init;
113 public int cblockh_init;
114 public int mode;
115 public int irreversible;
116 public int roi_compno;
117 public int roi_shift;
118 public int res_spec;
119
120 /// <summary>
121 /// Don't forget to initialize 33 elements
122 /// </summary>
123 public int[] prc_init;
124 /// <summary>
125 /// Don't forget to initialize 33 elements
126 /// </summary>
127 public int[] prch_init;
128
129 public string infile;
130 public string outfile;
131 public int index_on;
132 public string index;
133 public int image_offset_x0;
134 public int image_offset_y0;
135 public int subsampling_dx;
136 public int subsampling_dy;
137 public int decod_format;
138 public int cod_format;
139 public bool jpwl_epc_on;
140 public int jpwl_hprot_MH;
141 /// <summary>
142 /// Don't forget to initialize 16 elements
143 /// </summary>
144 public int[] jpwl_hprot_TPH_tileno;
145 /// <summary>
146 /// Don't forget to initialize 16 elements
147 /// </summary>
148 public int[] jpwl_hprot_TPH;
149
150 /// <summary>
151 /// Don't forget to initialize 16 elements
152 /// </summary>
153 public int[] jpwl_pprot_tileno;
154 public int[] jpwl_pprot_packno;
155 public int[] jpwl_pprot;
156 public int jpwl_sens_size;
157 public int jpwl_sense_addr;
158 public int jpwl_sens_range;
159 public int jpwl_sens_MH;
160
161 /// <summary>
162 /// Don't forget to initialize 16 elements
163 /// </summary>
164 public int[] jpwl_sens_TPH_tileno;
165
166 /// <summary>
167 /// Don't forget to initialize 16 elements
168 /// </summary>
169 public int[] jpwl_sens_TPH;
170 public CINEMA_MODE cp_cinema;
171 public int max_comp_size;
172 public sbyte tp_on;
173 public sbyte tp_flag;
174 public sbyte tcp_mct;
175 }
176
177 public struct opj_dparameters
178 {
179 public int cp_reduce;
180 public int cp_layer;
181 public string infile;
182 public string outfile;
183 public int decod_format;
184 public int cod_format;
185 public bool jpwl_correct;
186 public int jpwl_exp_comps;
187 public int jpwl_max_tiles;
188 public LIMIT_DECODING cp_limit_decoding;
189
190 }
191
192 public struct opj_common_fields
193 {
194 public bool is_decompressor;
195 public CODEC_FORMAT codec_format;
196 }
197
198 public struct opj_common_struct
199 {
200 public opj_common_fields flds;
201 }
202
203 public struct opj_cinfo
204 {
205 public opj_common_fields flds;
206 }
207 public struct opj_dinfo
208 {
209 public opj_common_fields flds;
210 }
211
212 public struct opj_cio
213 {
214 public opj_common_struct cinfo;
215 public int openmode;
216 public byte buffer;
217 public int length;
218 public byte start;
219 public byte end;
220 public byte bp;
221 }
222
223 public struct opj_image_comp
224 {
225 public int dx;
226 public int dy;
227 public int w;
228 public int h;
229 public int x0;
230 public int y0;
231 public int prec;
232 public int bpp;
233 public int sgnd;
234 public int resno_decoded;
235 public int factor;
236 public int data;
237 }
238
239 public struct opj_image
240 {
241 public int x0;
242 public int y0;
243 public int x1;
244 public int y1;
245 public int numcomps;
246 public COLOR_SPACE color_space;
247 public opj_image_comp comps;
248 }
249
250 public struct opj_image_comptparm
251 {
252 public int dx;
253 public int dy;
254 public int w;
255 public int h;
256 public int x0;
257 public int y0;
258 public int prec;
259 public int bpp;
260 public int sgnd;
261 }
262
263 public struct opj_packet_info
264 {
265 public int start_pos;
266 public int end_ph_pos;
267 public int end_pos;
268 public double disto;
269 }
270
271 public struct opj_tp_info
272 {
273 public int tp_start_pos;
274 public int tp_end_header;
275 public int tp_end_pos;
276 public int tp_start_pack;
277 public int tp_numpacks;
278 }
279
280 public struct opj_tile_info
281 {
282 public double thresh;
283 public int tileno;
284 public int start_pos;
285 public int end_header;
286 public int end_pos;
287 /// <summary>
288 /// Don't forget to initialize 33 elements
289 /// </summary>
290 public int[] pw;
291 /// <summary>
292 /// Don't forget to initialize 33 elements
293 /// </summary>
294 public int[] ph;
295 /// <summary>
296 /// Don't forget to initialize 33 elements
297 /// </summary>
298 public int[] pdx;
299 /// <summary>
300 /// Don't forget to initialize 33 elements
301 /// </summary>
302 public int[] pdy;
303
304 public opj_packet_info packet;
305 public int numpix;
306 public double distotile;
307 public int num_tps;
308 public opj_tp_info tp;
309 }
310
311 public struct opj_marker_info_t
312 {
313 public ushort type;
314 public int pos;
315 public int len;
316 }
317
318 public struct opj_codestream_info
319 {
320 public double D_max;
321 public int packno;
322 public int index_write;
323 public int image_w;
324 public int image_h;
325
326 public PROG_ORDER prog;
327
328 public int tile_x;
329 public int tile_y;
330 public int tile_Ox;
331 public int tile_Oy;
332 public int tw;
333 public int numcomps;
334 public int numlayers;
335 public int numdecompos;
336 public int marknum;
337 public opj_marker_info_t marker;
338 public int maxmarknum;
339 public int main_head_start;
340 public int main_head_end;
341 public int codestream_size;
342 public opj_tile_info tile;
343
344 }
345
346
347
348
349
350
351 public static class opj_defines
352 {
353 public const int OPJ_STREAM_READ = 0x0001;
354 public const int OPJ_STREAM_WRITE = 0x0002;
355
356 }
357
358}
diff --git a/OpenSim/Framework/OpenJpeg/pi.cs b/OpenSim/Framework/OpenJpeg/pi.cs
new file mode 100644
index 0000000..f7e211f
--- /dev/null
+++ b/OpenSim/Framework/OpenJpeg/pi.cs
@@ -0,0 +1,48 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.OpenJpeg
6{
7 public static class pi
8 {
9 }
10
11 public struct opj_pi_resolution
12 {
13 public int pdx, pdy;
14 public int pw, ph;
15 }
16
17 public struct opj_pi_comp
18 {
19 public int dx, dy;
20 public int numresolutions;
21 public opj_pi_resolution resolutions;
22 }
23
24 public struct obj_pi_iterator
25 {
26 public sbyte tp_on;
27 public short include;
28 public int step_l;
29 public int step_r;
30 public int step_c;
31 public int step_p;
32 public int compno;
33 public int resno;
34 public int precno;
35 public int layno;
36 public int first;
37 public opj_poc poc;
38 public int numcomps;
39 public opj_pi_comp comps;
40
41 public int tx0, ty0, tx1, ty1;
42 public int x, y, dx, dy;
43 }
44
45
46
47
48}