corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | /* |
2 | * CVS identifier: |
||
3 | * |
||
4 | * $Id: ForwardWT.java,v 1.60 2001/09/14 09:54:53 grosbois Exp $ |
||
5 | * |
||
6 | * Class: ForwardWT |
||
7 | * |
||
8 | * Description: This interface defines the specifics |
||
9 | * of forward wavelet transforms |
||
10 | * |
||
11 | * |
||
12 | * |
||
13 | * COPYRIGHT: |
||
14 | * |
||
15 | * This software module was originally developed by Raphaël Grosbois and |
||
16 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel |
||
17 | * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David |
||
18 | * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research |
||
19 | * Centre France S.A) in the course of development of the JPEG2000 |
||
20 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This |
||
21 | * software module is an implementation of a part of the JPEG 2000 |
||
22 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio |
||
23 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 |
||
24 | * Partners) agree not to assert against ISO/IEC and users of the JPEG |
||
25 | * 2000 Standard (Users) any of their rights under the copyright, not |
||
26 | * including other intellectual property rights, for this software module |
||
27 | * with respect to the usage by ISO/IEC and Users of this software module |
||
28 | * or modifications thereof for use in hardware or software products |
||
29 | * claiming conformance to the JPEG 2000 Standard. Those intending to use |
||
30 | * this software module in hardware or software products are advised that |
||
31 | * their use may infringe existing patents. The original developers of |
||
32 | * this software module, JJ2000 Partners and ISO/IEC assume no liability |
||
33 | * for use of this software module or modifications thereof. No license |
||
34 | * or right to this software module is granted for non JPEG 2000 Standard |
||
35 | * conforming products. JJ2000 Partners have full right to use this |
||
36 | * software module for his/her own purpose, assign or donate this |
||
37 | * software module to any third party and to inhibit third parties from |
||
38 | * using this software module for non JPEG 2000 Standard conforming |
||
39 | * products. This copyright notice must be included in all copies or |
||
40 | * derivative works of this software module. |
||
41 | * |
||
42 | * Copyright (c) 1999/2000 JJ2000 Partners. |
||
43 | * */ |
||
44 | using System; |
||
45 | using CSJ2K.j2k.codestream.writer; |
||
46 | using CSJ2K.j2k.codestream; |
||
47 | using CSJ2K.j2k.wavelet; |
||
48 | using CSJ2K.j2k.encoder; |
||
49 | using CSJ2K.j2k.image; |
||
50 | using CSJ2K.j2k.util; |
||
51 | using CSJ2K.j2k; |
||
52 | namespace CSJ2K.j2k.wavelet.analysis |
||
53 | { |
||
54 | |||
55 | /// <summary> This abstract class represents the forward wavelet transform functional |
||
56 | /// block. The functional block may actually be comprised of several classes |
||
57 | /// linked together, but a subclass of this abstract class is the one that is |
||
58 | /// returned as the functional block that performs the forward wavelet |
||
59 | /// transform. |
||
60 | /// |
||
61 | /// <p>This class assumes that data is transferred in code-blocks, as defined |
||
62 | /// by the 'CBlkWTDataSrc' interface. The internal calculation of the wavelet |
||
63 | /// transform may be done differently but a buffering class should convert to |
||
64 | /// that type of transfer.</p> |
||
65 | /// |
||
66 | /// </summary> |
||
67 | public abstract class ForwardWT:ImgDataAdapter, ForwWT, CBlkWTDataSrc |
||
68 | { |
||
69 | /// <summary> Returns the parameters that are used in this class and implementing |
||
70 | /// classes. It returns a 2D String array. Each of the 1D arrays is for a |
||
71 | /// different option, and they have 3 elements. The first element is the |
||
72 | /// option name, the second one is the synopsis and the third one is a long |
||
73 | /// description of what the parameter is. The synopsis or description may |
||
74 | /// be 'null', in which case it is assumed that there is no synopsis or |
||
75 | /// description of the option, respectively. Null may be returned if no |
||
76 | /// options are supported. |
||
77 | /// |
||
78 | /// </summary> |
||
79 | /// <returns> the options name, their synopsis and their explanation, or null |
||
80 | /// if no options are supported. |
||
81 | /// |
||
82 | /// </returns> |
||
83 | public static System.String[][] ParameterInfo |
||
84 | { |
||
85 | get |
||
86 | { |
||
87 | return pinfo; |
||
88 | } |
||
89 | |||
90 | } |
||
91 | public abstract int CbULY{get;} |
||
92 | public abstract int CbULX{get;} |
||
93 | |||
94 | /// <summary> ID for the dyadic wavelet tree decomposition (also called "Mallat" in |
||
95 | /// JPEG 2000): 0x00. |
||
96 | /// |
||
97 | /// </summary> |
||
98 | public const int WT_DECOMP_DYADIC = 0; |
||
99 | |||
100 | /// <summary>The prefix for wavelet transform options: 'W' </summary> |
||
101 | public const char OPT_PREFIX = 'W'; |
||
102 | |||
103 | /// <summary>The list of parameters that is accepted for wavelet transform. Options |
||
104 | /// for the wavelet transform start with 'W'. |
||
105 | /// </summary> |
||
106 | //UPGRADE_NOTE: Final was removed from the declaration of 'pinfo'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'" |
||
107 | private static readonly System.String[][] pinfo = new System.String[][]{new System.String[]{"Wlev", "<number of decomposition levels>", "Specifies the number of wavelet decomposition levels to apply to " + "the image. If 0 no wavelet transform is performed. All components " + "and all tiles have the same number of decomposition levels.", "5"}, new System.String[]{"Wwt", "[full]", "Specifies the wavelet transform to be used. Possible value is: " + "'full' (full page). The value 'full' performs a normal DWT.", "full"}, new System.String[]{"Wcboff", "<x y>", "Code-blocks partition offset in the reference grid. Allowed for " + "<x> and <y> are 0 and 1.\n" + "Note: This option is defined in JPEG 2000 part 2 and may not" + " be supported by all JPEG 2000 decoders.", "0 0"}}; |
||
108 | |||
109 | /// <summary> Initializes this object for the specified number of tiles 'nt' and |
||
110 | /// components 'nc'. |
||
111 | /// |
||
112 | /// </summary> |
||
113 | /// <param name="src">The source of ImgData |
||
114 | /// |
||
115 | /// </param> |
||
116 | protected internal ForwardWT(ImgData src):base(src) |
||
117 | { |
||
118 | } |
||
119 | |||
120 | /// <summary> Creates a ForwardWT object with the specified filters, and with other |
||
121 | /// options specified in the parameter list 'pl'. |
||
122 | /// |
||
123 | /// </summary> |
||
124 | /// <param name="src">The source of data to be transformed |
||
125 | /// |
||
126 | /// </param> |
||
127 | /// <param name="pl">The parameter list (or options). |
||
128 | /// |
||
129 | /// </param> |
||
130 | /// <param name="kers">The encoder specifications. |
||
131 | /// |
||
132 | /// </param> |
||
133 | /// <returns> A new ForwardWT object with the specified filters and options |
||
134 | /// from 'pl'. |
||
135 | /// |
||
136 | /// </returns> |
||
137 | /// <exception cref="IllegalArgumentException">If mandatory parameters are missing |
||
138 | /// or if invalid values are given. |
||
139 | /// |
||
140 | /// </exception> |
||
141 | public static ForwardWT createInstance(BlkImgDataSrc src, ParameterList pl, EncoderSpecs encSpec) |
||
142 | { |
||
143 | int deflev; // defdec removed |
||
144 | //System.String decompstr; |
||
145 | //System.String wtstr; |
||
146 | //System.String pstr; |
||
147 | //SupportClass.StreamTokenizerSupport stok; |
||
148 | //SupportClass.Tokenizer strtok; |
||
149 | //int prefx, prefy; // Partitioning reference point coordinates |
||
150 | |||
151 | // Check parameters |
||
152 | pl.checkList(OPT_PREFIX, CSJ2K.j2k.util.ParameterList.toNameArray(pinfo)); |
||
153 | |||
154 | deflev = ((System.Int32) encSpec.dls.getDefault()); |
||
155 | |||
156 | // Code-block partition origin |
||
157 | System.String str = ""; |
||
158 | if (pl.getParameter("Wcboff") == null) |
||
159 | { |
||
160 | throw new System.ApplicationException("You must specify an argument to the '-Wcboff' " + "option. See usage with the '-u' option"); |
||
161 | } |
||
162 | SupportClass.Tokenizer stk = new SupportClass.Tokenizer(pl.getParameter("Wcboff")); |
||
163 | if (stk.Count != 2) |
||
164 | { |
||
165 | throw new System.ArgumentException("'-Wcboff' option needs two" + " arguments. See usage with " + "the '-u' option."); |
||
166 | } |
||
167 | int cb0x = 0; |
||
168 | str = stk.NextToken(); |
||
169 | try |
||
170 | { |
||
171 | cb0x = (System.Int32.Parse(str)); |
||
172 | } |
||
173 | catch (System.FormatException) |
||
174 | { |
||
175 | throw new System.ArgumentException("Bad first parameter for the " + "'-Wcboff' option: " + str); |
||
176 | } |
||
177 | if (cb0x < 0 || cb0x > 1) |
||
178 | { |
||
179 | throw new System.ArgumentException("Invalid horizontal " + "code-block partition origin."); |
||
180 | } |
||
181 | int cb0y = 0; |
||
182 | str = stk.NextToken(); |
||
183 | try |
||
184 | { |
||
185 | cb0y = (System.Int32.Parse(str)); |
||
186 | } |
||
187 | catch (System.FormatException) |
||
188 | { |
||
189 | throw new System.ArgumentException("Bad second parameter for the " + "'-Wcboff' option: " + str); |
||
190 | } |
||
191 | if (cb0y < 0 || cb0y > 1) |
||
192 | { |
||
193 | throw new System.ArgumentException("Invalid vertical " + "code-block partition origin."); |
||
194 | } |
||
195 | if (cb0x != 0 || cb0y != 0) |
||
196 | { |
||
197 | FacilityManager.getMsgLogger().printmsg(CSJ2K.j2k.util.MsgLogger_Fields.WARNING, "Code-blocks partition origin is " + "different from (0,0). This is defined in JPEG 2000" + " part 2 and may be not supported by all JPEG 2000 " + "decoders."); |
||
198 | } |
||
199 | |||
200 | return new ForwWTFull(src, encSpec, cb0x, cb0y); |
||
201 | } |
||
202 | public abstract bool isReversible(int param1, int param2); |
||
203 | public abstract CSJ2K.j2k.wavelet.analysis.CBlkWTData getNextInternCodeBlock(int param1, CSJ2K.j2k.wavelet.analysis.CBlkWTData param2); |
||
204 | public abstract int getFixedPoint(int param1); |
||
205 | public abstract CSJ2K.j2k.wavelet.analysis.AnWTFilter[] getHorAnWaveletFilters(int param1, int param2); |
||
206 | public abstract CSJ2K.j2k.wavelet.analysis.AnWTFilter[] getVertAnWaveletFilters(int param1, int param2); |
||
207 | public abstract CSJ2K.j2k.wavelet.analysis.SubbandAn getAnSubbandTree(int param1, int param2); |
||
208 | public abstract int getDecompLevels(int param1, int param2); |
||
209 | public abstract CSJ2K.j2k.wavelet.analysis.CBlkWTData getNextCodeBlock(int param1, CSJ2K.j2k.wavelet.analysis.CBlkWTData param2); |
||
210 | public abstract int getImplementationType(int param1); |
||
211 | public abstract int getDataType(int param1, int param2); |
||
212 | public abstract int getDecomp(int param1, int param2); |
||
213 | } |
||
214 | } |