aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/OpenJpeg/openjpeg.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/OpenJpeg/openjpeg.cs')
-rw-r--r--OpenSim/Framework/OpenJpeg/openjpeg.cs733
1 files changed, 375 insertions, 358 deletions
diff --git a/OpenSim/Framework/OpenJpeg/openjpeg.cs b/OpenSim/Framework/OpenJpeg/openjpeg.cs
index 2d5e4b5..f0b2518 100644
--- a/OpenSim/Framework/OpenJpeg/openjpeg.cs
+++ b/OpenSim/Framework/OpenJpeg/openjpeg.cs
@@ -1,358 +1,375 @@
1using System; 1/*
2using System.Collections.Generic; 2 * Copyright (c) Contributors, http://opensimulator.org/
3using System.Text; 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 4 *
5namespace OpenSim.Framework.OpenJpeg 5 * Redistribution and use in source and binary forms, with or without
6{ 6 * modification, are permitted provided that the following conditions are met:
7 public class openjpeg 7 * * Redistributions of source code must retain the above copyright
8 { 8 * notice, this list of conditions and the following disclaimer.
9 public openjpeg() 9 * * Redistributions in binary form must reproduce the above copyright
10 { 10 * notice, this list of conditions and the following disclaimer in the
11 11 * documentation and/or other materials provided with the distribution.
12 12 * * Neither the name of the OpenSimulator Project nor the
13 } 13 * names of its contributors may be used to endorse or promote products
14 } 14 * derived from this software without specific prior written permission.
15 15 *
16 public enum PROG_ORDER 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 { 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 PROG_UNKNOWN = -1, 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 LRCP = 0, 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 RLCP = 1, 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 RPCL = 2, 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 PCRL = 3, 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 CPRL = 4 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 } 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 public enum RSIZ_CAPABILITIES 26 */
27 { 27
28 STD_RSIZ = 0, 28using System;
29 CINEMA2K = 3, 29using System.Collections.Generic;
30 CINEMA4K = 4 30using System.Text;
31 } 31
32 32namespace OpenSim.Framework.OpenJpeg
33 public enum CINEMA_MODE 33{
34 { 34 public class openjpeg
35 OFF = 0, 35 {
36 CINEMA2K_24 = 1, 36 public openjpeg()
37 CINEMA2K_48 = 2, 37 {
38 CINEMA4K_24 = 3 38 }
39 } 39 }
40 40
41 public enum COLOR_SPACE 41 public enum PROG_ORDER
42 { 42 {
43 CLRSPC_UNKNOWN = -1, 43 PROG_UNKNOWN = -1,
44 CLRSPC_SRGB = 1, 44 LRCP = 0,
45 CLRSPC_GRAY = 2, 45 RLCP = 1,
46 CLRSPC_SYCC = 3 46 RPCL = 2,
47 } 47 PCRL = 3,
48 48 CPRL = 4
49 public enum CODEC_FORMAT 49 }
50 { 50
51 CODEC_UNKNOWN = -1, 51 public enum RSIZ_CAPABILITIES
52 CODEC_J2K = 0, 52 {
53 CODEC_JPT = 1, 53 STD_RSIZ = 0,
54 CODEC_JP2 = 2 54 CINEMA2K = 3,
55 } 55 CINEMA4K = 4
56 56 }
57 public enum LIMIT_DECODING 57
58 { 58 public enum CINEMA_MODE
59 NO_LIMITATION = 0, 59 {
60 LIMIT_TO_MAIN_HEADER=1, 60 OFF = 0,
61 DECODE_ALL_BUT_PACKETS = 2 61 CINEMA2K_24 = 1,
62 } 62 CINEMA2K_48 = 2,
63 63 CINEMA4K_24 = 3
64 public struct opj_poc 64 }
65 { 65
66 public int resno0, compno0; 66 public enum COLOR_SPACE
67 public int layno1, resno1, compno1; 67 {
68 public int layno0, precno0, precno1; 68 CLRSPC_UNKNOWN = -1,
69 public PROG_ORDER prg1, prg; 69 CLRSPC_SRGB = 1,
70 /// <summary> 70 CLRSPC_GRAY = 2,
71 /// Don't forget to initialize with 5 elements 71 CLRSPC_SYCC = 3
72 /// </summary> 72 }
73 public sbyte[] progorder; 73
74 public int tile; 74 public enum CODEC_FORMAT
75 public int tx0, tx1, ty0, ty1; 75 {
76 public int layS, resS, copmS, prcS; 76 CODEC_UNKNOWN = -1,
77 public int layE, resE, compE, prcE; 77 CODEC_J2K = 0,
78 public int txS, txE, tyS, tyE, dx, dy; 78 CODEC_JPT = 1,
79 public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t; 79 CODEC_JP2 = 2
80 } 80 }
81 81
82 public struct opj_cparameters 82 public enum LIMIT_DECODING
83 { 83 {
84 public bool tile_size_on; 84 NO_LIMITATION = 0,
85 public int cp_tx0; 85 LIMIT_TO_MAIN_HEADER=1,
86 public int cp_ty0; 86 DECODE_ALL_BUT_PACKETS = 2
87 public int cp_tdx; 87 }
88 public int cp_tdy; 88
89 public int cp_disto_alloc; 89 public struct opj_poc
90 public int cp_fixed_alloc; 90 {
91 public int cp_fixed_wuality; 91 public int resno0, compno0;
92 public int cp_matrice; 92 public int layno1, resno1, compno1;
93 public sbyte cp_comment; 93 public int layno0, precno0, precno1;
94 public int csty; 94 public PROG_ORDER prg1, prg;
95 public PROG_ORDER prog_order; 95 /// <summary>
96 96 /// Don't forget to initialize with 5 elements
97 /// <summary> 97 /// </summary>
98 /// Don't forget to initialize 32 elements 98 public sbyte[] progorder;
99 /// </summary> 99 public int tile;
100 public opj_poc[] POC; 100 public int tx0, tx1, ty0, ty1;
101 public int numpocs; 101 public int layS, resS, copmS, prcS;
102 public int tcp_numlayers; 102 public int layE, resE, compE, prcE;
103 /// <summary> 103 public int txS, txE, tyS, tyE, dx, dy;
104 /// Don't forget to intitialize 100 elements 104 public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t;
105 /// </summary> 105 }
106 public float[] tcp_rates; 106
107 /// <summary> 107 public struct opj_cparameters
108 /// Don't forget to initialize 100 elements 108 {
109 /// </summary> 109 public bool tile_size_on;
110 public float[] tcp_distoratio; 110 public int cp_tx0;
111 public int numresolution; 111 public int cp_ty0;
112 public int cblockw_init; 112 public int cp_tdx;
113 public int cblockh_init; 113 public int cp_tdy;
114 public int mode; 114 public int cp_disto_alloc;
115 public int irreversible; 115 public int cp_fixed_alloc;
116 public int roi_compno; 116 public int cp_fixed_wuality;
117 public int roi_shift; 117 public int cp_matrice;
118 public int res_spec; 118 public sbyte cp_comment;
119 119 public int csty;
120 /// <summary> 120 public PROG_ORDER prog_order;
121 /// Don't forget to initialize 33 elements 121
122 /// </summary> 122 /// <summary>
123 public int[] prc_init; 123 /// Don't forget to initialize 32 elements
124 /// <summary> 124 /// </summary>
125 /// Don't forget to initialize 33 elements 125 public opj_poc[] POC;
126 /// </summary> 126 public int numpocs;
127 public int[] prch_init; 127 public int tcp_numlayers;
128 128 /// <summary>
129 public string infile; 129 /// Don't forget to intitialize 100 elements
130 public string outfile; 130 /// </summary>
131 public int index_on; 131 public float[] tcp_rates;
132 public string index; 132 /// <summary>
133 public int image_offset_x0; 133 /// Don't forget to initialize 100 elements
134 public int image_offset_y0; 134 /// </summary>
135 public int subsampling_dx; 135 public float[] tcp_distoratio;
136 public int subsampling_dy; 136 public int numresolution;
137 public int decod_format; 137 public int cblockw_init;
138 public int cod_format; 138 public int cblockh_init;
139 public bool jpwl_epc_on; 139 public int mode;
140 public int jpwl_hprot_MH; 140 public int irreversible;
141 /// <summary> 141 public int roi_compno;
142 /// Don't forget to initialize 16 elements 142 public int roi_shift;
143 /// </summary> 143 public int res_spec;
144 public int[] jpwl_hprot_TPH_tileno; 144
145 /// <summary> 145 /// <summary>
146 /// Don't forget to initialize 16 elements 146 /// Don't forget to initialize 33 elements
147 /// </summary> 147 /// </summary>
148 public int[] jpwl_hprot_TPH; 148 public int[] prc_init;
149 149 /// <summary>
150 /// <summary> 150 /// Don't forget to initialize 33 elements
151 /// Don't forget to initialize 16 elements 151 /// </summary>
152 /// </summary> 152 public int[] prch_init;
153 public int[] jpwl_pprot_tileno; 153
154 public int[] jpwl_pprot_packno; 154 public string infile;
155 public int[] jpwl_pprot; 155 public string outfile;
156 public int jpwl_sens_size; 156 public int index_on;
157 public int jpwl_sense_addr; 157 public string index;
158 public int jpwl_sens_range; 158 public int image_offset_x0;
159 public int jpwl_sens_MH; 159 public int image_offset_y0;
160 160 public int subsampling_dx;
161 /// <summary> 161 public int subsampling_dy;
162 /// Don't forget to initialize 16 elements 162 public int decod_format;
163 /// </summary> 163 public int cod_format;
164 public int[] jpwl_sens_TPH_tileno; 164 public bool jpwl_epc_on;
165 165 public int jpwl_hprot_MH;
166 /// <summary> 166 /// <summary>
167 /// Don't forget to initialize 16 elements 167 /// Don't forget to initialize 16 elements
168 /// </summary> 168 /// </summary>
169 public int[] jpwl_sens_TPH; 169 public int[] jpwl_hprot_TPH_tileno;
170 public CINEMA_MODE cp_cinema; 170 /// <summary>
171 public int max_comp_size; 171 /// Don't forget to initialize 16 elements
172 public sbyte tp_on; 172 /// </summary>
173 public sbyte tp_flag; 173 public int[] jpwl_hprot_TPH;
174 public sbyte tcp_mct; 174
175 } 175 /// <summary>
176 176 /// Don't forget to initialize 16 elements
177 public struct opj_dparameters 177 /// </summary>
178 { 178 public int[] jpwl_pprot_tileno;
179 public int cp_reduce; 179 public int[] jpwl_pprot_packno;
180 public int cp_layer; 180 public int[] jpwl_pprot;
181 public string infile; 181 public int jpwl_sens_size;
182 public string outfile; 182 public int jpwl_sense_addr;
183 public int decod_format; 183 public int jpwl_sens_range;
184 public int cod_format; 184 public int jpwl_sens_MH;
185 public bool jpwl_correct; 185
186 public int jpwl_exp_comps; 186 /// <summary>
187 public int jpwl_max_tiles; 187 /// Don't forget to initialize 16 elements
188 public LIMIT_DECODING cp_limit_decoding; 188 /// </summary>
189 189 public int[] jpwl_sens_TPH_tileno;
190 } 190
191 191 /// <summary>
192 public struct opj_common_fields 192 /// Don't forget to initialize 16 elements
193 { 193 /// </summary>
194 public bool is_decompressor; 194 public int[] jpwl_sens_TPH;
195 public CODEC_FORMAT codec_format; 195 public CINEMA_MODE cp_cinema;
196 } 196 public int max_comp_size;
197 197 public sbyte tp_on;
198 public struct opj_common_struct 198 public sbyte tp_flag;
199 { 199 public sbyte tcp_mct;
200 public opj_common_fields flds; 200 }
201 } 201
202 202 public struct opj_dparameters
203 public struct opj_cinfo 203 {
204 { 204 public int cp_reduce;
205 public opj_common_fields flds; 205 public int cp_layer;
206 } 206 public string infile;
207 public struct opj_dinfo 207 public string outfile;
208 { 208 public int decod_format;
209 public opj_common_fields flds; 209 public int cod_format;
210 } 210 public bool jpwl_correct;
211 211 public int jpwl_exp_comps;
212 public struct opj_cio 212 public int jpwl_max_tiles;
213 { 213 public LIMIT_DECODING cp_limit_decoding;
214 public opj_common_struct cinfo; 214 }
215 public int openmode; 215
216 public byte buffer; 216 public struct opj_common_fields
217 public int length; 217 {
218 public byte start; 218 public bool is_decompressor;
219 public byte end; 219 public CODEC_FORMAT codec_format;
220 public byte bp; 220 }
221 } 221
222 222 public struct opj_common_struct
223 public struct opj_image_comp 223 {
224 { 224 public opj_common_fields flds;
225 public int dx; 225 }
226 public int dy; 226
227 public int w; 227 public struct opj_cinfo
228 public int h; 228 {
229 public int x0; 229 public opj_common_fields flds;
230 public int y0; 230 }
231 public int prec; 231
232 public int bpp; 232 public struct opj_dinfo
233 public int sgnd; 233 {
234 public int resno_decoded; 234 public opj_common_fields flds;
235 public int factor; 235 }
236 public int data; 236
237 } 237 public struct opj_cio
238 238 {
239 public struct opj_image 239 public opj_common_struct cinfo;
240 { 240 public int openmode;
241 public int x0; 241 public byte buffer;
242 public int y0; 242 public int length;
243 public int x1; 243 public byte start;
244 public int y1; 244 public byte end;
245 public int numcomps; 245 public byte bp;
246 public COLOR_SPACE color_space; 246 }
247 public opj_image_comp comps; 247
248 } 248 public struct opj_image_comp
249 249 {
250 public struct opj_image_comptparm 250 public int dx;
251 { 251 public int dy;
252 public int dx; 252 public int w;
253 public int dy; 253 public int h;
254 public int w; 254 public int x0;
255 public int h; 255 public int y0;
256 public int x0; 256 public int prec;
257 public int y0; 257 public int bpp;
258 public int prec; 258 public int sgnd;
259 public int bpp; 259 public int resno_decoded;
260 public int sgnd; 260 public int factor;
261 } 261 public int data;
262 262 }
263 public struct opj_packet_info 263
264 { 264 public struct opj_image
265 public int start_pos; 265 {
266 public int end_ph_pos; 266 public int x0;
267 public int end_pos; 267 public int y0;
268 public double disto; 268 public int x1;
269 } 269 public int y1;
270 270 public int numcomps;
271 public struct opj_tp_info 271 public COLOR_SPACE color_space;
272 { 272 public opj_image_comp comps;
273 public int tp_start_pos; 273 }
274 public int tp_end_header; 274
275 public int tp_end_pos; 275 public struct opj_image_comptparm
276 public int tp_start_pack; 276 {
277 public int tp_numpacks; 277 public int dx;
278 } 278 public int dy;
279 279 public int w;
280 public struct opj_tile_info 280 public int h;
281 { 281 public int x0;
282 public double thresh; 282 public int y0;
283 public int tileno; 283 public int prec;
284 public int start_pos; 284 public int bpp;
285 public int end_header; 285 public int sgnd;
286 public int end_pos; 286 }
287 /// <summary> 287
288 /// Don't forget to initialize 33 elements 288 public struct opj_packet_info
289 /// </summary> 289 {
290 public int[] pw; 290 public int start_pos;
291 /// <summary> 291 public int end_ph_pos;
292 /// Don't forget to initialize 33 elements 292 public int end_pos;
293 /// </summary> 293 public double disto;
294 public int[] ph; 294 }
295 /// <summary> 295
296 /// Don't forget to initialize 33 elements 296 public struct opj_tp_info
297 /// </summary> 297 {
298 public int[] pdx; 298 public int tp_start_pos;
299 /// <summary> 299 public int tp_end_header;
300 /// Don't forget to initialize 33 elements 300 public int tp_end_pos;
301 /// </summary> 301 public int tp_start_pack;
302 public int[] pdy; 302 public int tp_numpacks;
303 303 }
304 public opj_packet_info packet; 304
305 public int numpix; 305 public struct opj_tile_info
306 public double distotile; 306 {
307 public int num_tps; 307 public double thresh;
308 public opj_tp_info tp; 308 public int tileno;
309 } 309 public int start_pos;
310 310 public int end_header;
311 public struct opj_marker_info_t 311 public int end_pos;
312 { 312 /// <summary>
313 public ushort type; 313 /// Don't forget to initialize 33 elements
314 public int pos; 314 /// </summary>
315 public int len; 315 public int[] pw;
316 } 316 /// <summary>
317 317 /// Don't forget to initialize 33 elements
318 public struct opj_codestream_info 318 /// </summary>
319 { 319 public int[] ph;
320 public double D_max; 320 /// <summary>
321 public int packno; 321 /// Don't forget to initialize 33 elements
322 public int index_write; 322 /// </summary>
323 public int image_w; 323 public int[] pdx;
324 public int image_h; 324 /// <summary>
325 325 /// Don't forget to initialize 33 elements
326 public PROG_ORDER prog; 326 /// </summary>
327 327 public int[] pdy;
328 public int tile_x; 328
329 public int tile_y; 329 public opj_packet_info packet;
330 public int tile_Ox; 330 public int numpix;
331 public int tile_Oy; 331 public double distotile;
332 public int tw; 332 public int num_tps;
333 public int numcomps; 333 public opj_tp_info tp;
334 public int numlayers; 334 }
335 public int numdecompos; 335
336 public int marknum; 336 public struct opj_marker_info_t
337 public opj_marker_info_t marker; 337 {
338 public int maxmarknum; 338 public ushort type;
339 public int main_head_start; 339 public int pos;
340 public int main_head_end; 340 public int len;
341 public int codestream_size; 341 }
342 public opj_tile_info tile; 342
343 343 public struct opj_codestream_info
344 } 344 {
345 345 public double D_max;
346 346 public int packno;
347 347 public int index_write;
348 348 public int image_w;
349 349 public int image_h;
350 350
351 public static class opj_defines 351 public PROG_ORDER prog;
352 { 352
353 public const int OPJ_STREAM_READ = 0x0001; 353 public int tile_x;
354 public const int OPJ_STREAM_WRITE = 0x0002; 354 public int tile_y;
355 355 public int tile_Ox;
356 } 356 public int tile_Oy;
357 357 public int tw;
358} 358 public int numcomps;
359 public int numlayers;
360 public int numdecompos;
361 public int marknum;
362 public opj_marker_info_t marker;
363 public int maxmarknum;
364 public int main_head_start;
365 public int main_head_end;
366 public int codestream_size;
367 public opj_tile_info tile;
368 }
369
370 public static class opj_defines
371 {
372 public const int OPJ_STREAM_READ = 0x0001;
373 public const int OPJ_STREAM_WRITE = 0x0002;
374 }
375}