diff options
Diffstat (limited to 'OpenSim/Framework/OpenJpeg/j2k.cs')
-rw-r--r-- | OpenSim/Framework/OpenJpeg/j2k.cs | 318 |
1 files changed, 171 insertions, 147 deletions
diff --git a/OpenSim/Framework/OpenJpeg/j2k.cs b/OpenSim/Framework/OpenJpeg/j2k.cs index f655364..8751792 100644 --- a/OpenSim/Framework/OpenJpeg/j2k.cs +++ b/OpenSim/Framework/OpenJpeg/j2k.cs | |||
@@ -1,125 +1,149 @@ | |||
1 | using System; | 1 | /* |
2 | using System.Collections.Generic; | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | using System.Text; | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | 4 | * | |
5 | namespace 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 | 7 | * * Redistributions of source code must retain the above copyright | |
8 | public static class j2k | 8 | * notice, this list of conditions and the following disclaimer. |
9 | { | 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 | public enum J2K_STATUS | 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 | J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ | 14 | * derived from this software without specific prior written permission. |
15 | J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ | 15 | * |
16 | J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */ | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */ | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | } | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 | public enum J2K_T2_MODE | 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 | THRESH_CALC = 0, /** Function called in Rate allocation process*/ | 26 | */ |
27 | FINAL_PASS = 1 /** Function called in Tier 2 process*/ | 27 | |
28 | } | 28 | using System; |
29 | 29 | using System.Collections.Generic; | |
30 | public struct opj_stepsize | 30 | using System.Text; |
31 | { | 31 | |
32 | public int expn; | 32 | namespace OpenSim.Framework.OpenJpeg |
33 | public int mant; | 33 | { |
34 | } | 34 | public static class j2k |
35 | 35 | { | |
36 | public struct opj_tccp | 36 | } |
37 | { | 37 | |
38 | public int csty; | 38 | public enum J2K_STATUS |
39 | public int numresolutions; | 39 | { |
40 | public int cblkw; | 40 | J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ |
41 | public int cblkh; | 41 | J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ |
42 | public int cblksty; | 42 | J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ |
43 | public int qmfbid; | 43 | J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ |
44 | public int qntsty; | 44 | J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ |
45 | /// <summary> | 45 | J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ |
46 | /// don't forget to initialize 97 elements | 46 | J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */ |
47 | /// </summary> | 47 | J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */ |
48 | public opj_stepsize[] stepsizes; | 48 | } |
49 | public int numgbits; | 49 | |
50 | public int roishift; | 50 | public enum J2K_T2_MODE |
51 | /// <summary> | 51 | { |
52 | /// Don't forget to initialize 33 elements | 52 | THRESH_CALC = 0, /** Function called in Rate allocation process*/ |
53 | /// </summary> | 53 | FINAL_PASS = 1 /** Function called in Tier 2 process*/ |
54 | public int[] prcw; | 54 | } |
55 | 55 | ||
56 | } | 56 | public struct opj_stepsize |
57 | 57 | { | |
58 | public struct opj_tcp | 58 | public int expn; |
59 | { | 59 | public int mant; |
60 | public int first; | 60 | } |
61 | public int csty; | 61 | |
62 | public PROG_ORDER prg; | 62 | public struct opj_tccp |
63 | public int numlayers; | 63 | { |
64 | public int mct; | 64 | public int csty; |
65 | /// <summary> | 65 | public int numresolutions; |
66 | /// don't forget to initialize to 100 | 66 | public int cblkw; |
67 | /// </summary> | 67 | public int cblkh; |
68 | public float[] rates; | 68 | public int cblksty; |
69 | public int numpocs; | 69 | public int qmfbid; |
70 | public int POC; | 70 | public int qntsty; |
71 | /// <summary> | 71 | /// <summary> |
72 | /// Don't forget to initialize to 32 | 72 | /// don't forget to initialize 97 elements |
73 | /// </summary> | 73 | /// </summary> |
74 | public opj_poc[] pocs; | 74 | public opj_stepsize[] stepsizes; |
75 | public byte ppt_data; | 75 | public int numgbits; |
76 | public byte ppt_data_first; | 76 | public int roishift; |
77 | public int ppt; | 77 | /// <summary> |
78 | public int ppt_store; | 78 | /// Don't forget to initialize 33 elements |
79 | public int ppt_len; | 79 | /// </summary> |
80 | /// <summary> | 80 | public int[] prcw; |
81 | /// Don't forget to initialize 100 elements | 81 | } |
82 | /// </summary> | 82 | |
83 | public float[] distoratio; | 83 | public struct opj_tcp |
84 | public opj_tccp tccps; | 84 | { |
85 | 85 | public int first; | |
86 | } | 86 | public int csty; |
87 | 87 | public PROG_ORDER prg; | |
88 | public struct opj_cp | 88 | public int numlayers; |
89 | { | 89 | public int mct; |
90 | public CINEMA_MODE cinema; | 90 | /// <summary> |
91 | public int max_comp_size; | 91 | /// don't forget to initialize to 100 |
92 | public int img_size; | 92 | /// </summary> |
93 | public RSIZ_CAPABILITIES rsiz; | 93 | public float[] rates; |
94 | public sbyte tp_on; | 94 | public int numpocs; |
95 | public sbyte tp_flag; | 95 | public int POC; |
96 | public int tp_pos; | 96 | /// <summary> |
97 | public int distro_alloc; | 97 | /// Don't forget to initialize to 32 |
98 | public int fixed_alloc; | 98 | /// </summary> |
99 | public int fixed_quality; | 99 | public opj_poc[] pocs; |
100 | public int reduce; | 100 | public byte ppt_data; |
101 | public int layer; | 101 | public byte ppt_data_first; |
102 | public LIMIT_DECODING limit_decoding; | 102 | public int ppt; |
103 | public int tx0; | 103 | public int ppt_store; |
104 | public int ty0; | 104 | public int ppt_len; |
105 | public int tdx; | 105 | /// <summary> |
106 | public int tdy; | 106 | /// Don't forget to initialize 100 elements |
107 | public sbyte? comment; | 107 | /// </summary> |
108 | public int tw; | 108 | public float[] distoratio; |
109 | public int th; | 109 | public opj_tccp tccps; |
110 | public int? tileno; | 110 | } |
111 | public byte ppm_data; | 111 | |
112 | public byte ppm_data_first; | 112 | public struct opj_cp |
113 | public int ppm; | 113 | { |
114 | public int ppm_store; | 114 | public CINEMA_MODE cinema; |
115 | public int ppm_previous; | 115 | public int max_comp_size; |
116 | public int ppm_len; | 116 | public int img_size; |
117 | public opj_tcp tcps; | 117 | public RSIZ_CAPABILITIES rsiz; |
118 | public int matrice; | 118 | public sbyte tp_on; |
119 | } | 119 | public sbyte tp_flag; |
120 | 120 | public int tp_pos; | |
121 | public static class j2kdefines | 121 | public int distro_alloc; |
122 | { | 122 | public int fixed_alloc; |
123 | public int fixed_quality; | ||
124 | public int reduce; | ||
125 | public int layer; | ||
126 | public LIMIT_DECODING limit_decoding; | ||
127 | public int tx0; | ||
128 | public int ty0; | ||
129 | public int tdx; | ||
130 | public int tdy; | ||
131 | public sbyte? comment; | ||
132 | public int tw; | ||
133 | public int th; | ||
134 | public int? tileno; | ||
135 | public byte ppm_data; | ||
136 | public byte ppm_data_first; | ||
137 | public int ppm; | ||
138 | public int ppm_store; | ||
139 | public int ppm_previous; | ||
140 | public int ppm_len; | ||
141 | public opj_tcp tcps; | ||
142 | public int matrice; | ||
143 | } | ||
144 | |||
145 | public static class j2kdefines | ||
146 | { | ||
123 | public const uint J2K_CP_CSTY_PRT = 0x01; | 147 | public const uint J2K_CP_CSTY_PRT = 0x01; |
124 | public const uint J2K_CP_CSTY_SOP = 0x02; | 148 | public const uint J2K_CP_CSTY_SOP = 0x02; |
125 | public const uint J2K_CP_CSTY_EPH = 0x04; | 149 | public const uint J2K_CP_CSTY_EPH = 0x04; |
@@ -131,28 +155,28 @@ namespace OpenSim.Framework.OpenJpeg | |||
131 | public const uint J2K_CCP_CBLKSTY_PTERM =0x10; | 155 | public const uint J2K_CCP_CBLKSTY_PTERM =0x10; |
132 | public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20; | 156 | public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20; |
133 | public const uint J2K_CCP_QNTSTY_NOQNT = 0; | 157 | public const uint J2K_CCP_QNTSTY_NOQNT = 0; |
134 | public const uint J2K_CCP_QNTSTY_SIQNT = 1; | 158 | public const uint J2K_CCP_QNTSTY_SIQNT = 1; |
135 | public const uint J2K_CCP_QNTSTY_SEQNT = 2; | 159 | public const uint J2K_CCP_QNTSTY_SEQNT = 2; |
136 | 160 | ||
137 | public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */ | 161 | public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */ |
138 | public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */ | 162 | public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */ |
139 | public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */ | 163 | public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */ |
140 | public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */ | 164 | public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */ |
141 | public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */ | 165 | public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */ |
142 | public const uint J2K_MS_COD = 0xff52; /**< COD marker value */ | 166 | public const uint J2K_MS_COD = 0xff52; /**< COD marker value */ |
143 | public const uint J2K_MS_COC = 0xff53; /**< COC marker value */ | 167 | public const uint J2K_MS_COC = 0xff53; /**< COC marker value */ |
144 | public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */ | 168 | public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */ |
145 | public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */ | 169 | public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */ |
146 | public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */ | 170 | public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */ |
147 | public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */ | 171 | public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */ |
148 | public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */ | 172 | public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */ |
149 | public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */ | 173 | public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */ |
150 | public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */ | 174 | public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */ |
151 | public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */ | 175 | public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */ |
152 | public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */ | 176 | public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */ |
153 | public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */ | 177 | public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */ |
154 | public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */ | 178 | public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */ |
155 | public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */ | 179 | public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */ |
156 | public const uint J2K_MS_COM = 0xff64; /**< COM marker value */ | 180 | public const uint J2K_MS_COM = 0xff64; /**< COM marker value */ |
157 | } | 181 | } |
158 | } | 182 | } |