aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/OpenJpeg/openjpeg.cs
blob: f0b2518f0b084a4780f68856289fc34215a0348d (plain)
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
/*
 * Copyright (c) Contributors, http://opensimulator.org/
 * See CONTRIBUTORS.TXT for a full list of copyright holders.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the OpenSimulator Project nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

using System;
using System.Collections.Generic;
using System.Text;

namespace OpenSim.Framework.OpenJpeg
{
    public class openjpeg
    {
        public openjpeg()
        {
        }
    }

    public enum PROG_ORDER
    {
        PROG_UNKNOWN = -1,
        LRCP = 0,
        RLCP = 1,
        RPCL = 2, 
        PCRL = 3,
        CPRL = 4
    }

    public enum RSIZ_CAPABILITIES
    {
        STD_RSIZ = 0,
        CINEMA2K = 3,
        CINEMA4K = 4
    }

    public enum CINEMA_MODE
    {
        OFF = 0,
        CINEMA2K_24 = 1,
        CINEMA2K_48 = 2,
        CINEMA4K_24 = 3
    }

    public enum COLOR_SPACE
    {
        CLRSPC_UNKNOWN = -1,
        CLRSPC_SRGB = 1,
        CLRSPC_GRAY = 2,
        CLRSPC_SYCC = 3
    }

    public enum CODEC_FORMAT
    {
        CODEC_UNKNOWN = -1,
        CODEC_J2K = 0,
        CODEC_JPT = 1,
        CODEC_JP2 = 2
    }

    public enum LIMIT_DECODING
    {
        NO_LIMITATION = 0,
        LIMIT_TO_MAIN_HEADER=1,
        DECODE_ALL_BUT_PACKETS = 2
    }

    public struct opj_poc
    {
        public int resno0, compno0;
        public int layno1, resno1, compno1;
        public int layno0, precno0, precno1;
        public PROG_ORDER prg1, prg;
        /// <summary>
        /// Don't forget to initialize with 5 elements
        /// </summary>
        public sbyte[] progorder;
        public int tile;
        public int tx0, tx1, ty0, ty1;
        public int layS, resS, copmS, prcS;
        public int layE, resE, compE, prcE;
        public int txS, txE, tyS, tyE, dx, dy;
        public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t;
    }

    public struct opj_cparameters
    {
        public bool tile_size_on;
        public int cp_tx0;
        public int cp_ty0;
        public int cp_tdx;
        public int cp_tdy;
        public int cp_disto_alloc;
        public int cp_fixed_alloc;
        public int cp_fixed_wuality;
        public int cp_matrice;
        public sbyte cp_comment;
        public int csty;
        public PROG_ORDER prog_order;

        /// <summary>
        /// Don't forget to initialize 32 elements
        /// </summary>
        public opj_poc[] POC;
        public int numpocs;
        public int tcp_numlayers;
        /// <summary>
        /// Don't forget to intitialize 100 elements
        /// </summary>
        public float[] tcp_rates;
        /// <summary>
        /// Don't forget to initialize 100 elements
        /// </summary>
        public float[] tcp_distoratio;
        public int numresolution;
        public int cblockw_init;
        public int cblockh_init;
        public int mode;
        public int irreversible;
        public int roi_compno;
        public int roi_shift;
        public int res_spec;

        /// <summary>
        /// Don't forget to initialize 33 elements
        /// </summary>
        public int[] prc_init;
        /// <summary>
        /// Don't forget to initialize 33 elements
        /// </summary>
        public int[] prch_init;

        public string infile;
        public string outfile;
        public int index_on;
        public string index;
        public int image_offset_x0;
        public int image_offset_y0;
        public int subsampling_dx;
        public int subsampling_dy;
        public int decod_format;
        public int cod_format;
        public bool jpwl_epc_on;
        public int jpwl_hprot_MH;
        /// <summary>
        /// Don't forget to initialize 16 elements
        /// </summary>
        public int[] jpwl_hprot_TPH_tileno;
        /// <summary>
        /// Don't forget to initialize 16 elements
        /// </summary>
        public int[] jpwl_hprot_TPH;

        /// <summary>
        /// Don't forget to initialize 16 elements
        /// </summary>
        public int[] jpwl_pprot_tileno;
        public int[] jpwl_pprot_packno;
        public int[] jpwl_pprot;
        public int jpwl_sens_size;
        public int jpwl_sense_addr;
        public int jpwl_sens_range;
        public int jpwl_sens_MH;

        /// <summary>
        /// Don't forget to initialize 16 elements
        /// </summary>
        public int[] jpwl_sens_TPH_tileno;

        /// <summary>
        /// Don't forget to initialize 16 elements
        /// </summary>
        public int[] jpwl_sens_TPH;
        public CINEMA_MODE cp_cinema;
        public int max_comp_size;
        public sbyte tp_on;
        public sbyte tp_flag;
        public sbyte tcp_mct;
    }

    public struct opj_dparameters
    {
        public int cp_reduce;
        public int cp_layer;
        public string infile;
        public string outfile;
        public int decod_format;
        public int cod_format;
        public bool jpwl_correct;
        public int jpwl_exp_comps;
        public int jpwl_max_tiles;
        public LIMIT_DECODING cp_limit_decoding;
    }

    public struct opj_common_fields
    {
        public bool is_decompressor;
        public CODEC_FORMAT codec_format;
    }

    public struct opj_common_struct
    {
        public opj_common_fields flds;
    }

    public struct opj_cinfo
    {
        public opj_common_fields flds;
    }

    public struct opj_dinfo
    {
        public opj_common_fields flds;
    }

    public struct opj_cio
    {
        public opj_common_struct cinfo;
        public int openmode;
        public byte buffer;
        public int length;
        public byte start;
        public byte end;
        public byte bp;
    }

    public struct opj_image_comp
    {
        public int dx;
        public int dy;
        public int w;
        public int h;
        public int x0;
        public int y0;
        public int prec;
        public int bpp;
        public int sgnd;
        public int resno_decoded;
        public int factor;
        public int data;
    }

    public struct opj_image
    {
        public int x0;
        public int y0;
        public int x1;
        public int y1;
        public int numcomps;
        public COLOR_SPACE color_space;
        public opj_image_comp comps;
    }

    public struct opj_image_comptparm
    {
        public int dx;
        public int dy;
        public int w;
        public int h;
        public int x0;
        public int y0;
        public int prec;
        public int bpp;
        public int sgnd;
    }

    public struct opj_packet_info
    {
        public int start_pos;
        public int end_ph_pos;
        public int end_pos;
        public double disto;
    }

    public struct opj_tp_info
    {
        public int tp_start_pos;
        public int tp_end_header;
        public int tp_end_pos;
        public int tp_start_pack;
        public int tp_numpacks;
    }

    public struct opj_tile_info
    {
        public double thresh;
        public int tileno;
        public int start_pos;
        public int end_header;
        public int end_pos;
        /// <summary>
        /// Don't forget to initialize 33 elements
        /// </summary>
        public int[] pw;
        /// <summary>
        /// Don't forget to initialize 33 elements
        /// </summary>
        public int[] ph;
        /// <summary>
        /// Don't forget to initialize 33 elements
        /// </summary>
        public int[] pdx;
        /// <summary>
        /// Don't forget to initialize 33 elements
        /// </summary>
        public int[] pdy;

        public opj_packet_info packet;
        public int numpix;
        public double distotile;
        public int num_tps;
        public opj_tp_info tp;
    }

    public struct opj_marker_info_t
    {
        public ushort type;
        public int pos;
        public int len;
    }

    public struct opj_codestream_info
    {
        public double D_max;
        public int packno;
        public int index_write;
        public int image_w;
        public int image_h;

        public PROG_ORDER prog;

        public int tile_x;
        public int tile_y;
        public int tile_Ox;
        public int tile_Oy;
        public int tw;
        public int numcomps;
        public int numlayers;
        public int numdecompos;
        public int marknum;
        public opj_marker_info_t marker;
        public int maxmarknum;
        public int main_head_start;
        public int main_head_end;
        public int codestream_size;
        public opj_tile_info tile;
    }

    public static class opj_defines
    {
        public const int OPJ_STREAM_READ = 0x0001;
        public const int OPJ_STREAM_WRITE = 0x0002;
    }
}