001: /*
002: * $RCSfile: ForwardWT.java,v $
003: * $Revision: 1.1 $
004: * $Date: 2005/02/11 05:02:31 $
005: * $State: Exp $
006: *
007: * Class: ForwardWT
008: *
009: * Description: This interface defines the specifics
010: * of forward wavelet transforms
011: *
012: *
013: *
014: * COPYRIGHT:
015: *
016: * This software module was originally developed by Raphaël Grosbois and
017: * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel
018: * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David
019: * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research
020: * Centre France S.A) in the course of development of the JPEG2000
021: * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This
022: * software module is an implementation of a part of the JPEG 2000
023: * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio
024: * Systems AB and Canon Research Centre France S.A (collectively JJ2000
025: * Partners) agree not to assert against ISO/IEC and users of the JPEG
026: * 2000 Standard (Users) any of their rights under the copyright, not
027: * including other intellectual property rights, for this software module
028: * with respect to the usage by ISO/IEC and Users of this software module
029: * or modifications thereof for use in hardware or software products
030: * claiming conformance to the JPEG 2000 Standard. Those intending to use
031: * this software module in hardware or software products are advised that
032: * their use may infringe existing patents. The original developers of
033: * this software module, JJ2000 Partners and ISO/IEC assume no liability
034: * for use of this software module or modifications thereof. No license
035: * or right to this software module is granted for non JPEG 2000 Standard
036: * conforming products. JJ2000 Partners have full right to use this
037: * software module for his/her own purpose, assign or donate this
038: * software module to any third party and to inhibit third parties from
039: * using this software module for non JPEG 2000 Standard conforming
040: * products. This copyright notice must be included in all copies or
041: * derivative works of this software module.
042: *
043: * Copyright (c) 1999/2000 JJ2000 Partners.
044: * */
045: package jj2000.j2k.wavelet.analysis;
046:
047: import jj2000.j2k.codestream.writer.*;
048: import jj2000.j2k.codestream.*;
049: import jj2000.j2k.wavelet.*;
050: import jj2000.j2k.image.*;
051: import jj2000.j2k.util.*;
052: import jj2000.j2k.*;
053:
054: import java.io.*;
055: import java.util.*;
056:
057: import com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriteParamJava;
058:
059: /**
060: * This abstract class represents the forward wavelet transform functional
061: * block. The functional block may actually be comprised of several classes
062: * linked together, but a subclass of this abstract class is the one that is
063: * returned as the functional block that performs the forward wavelet
064: * transform.
065: *
066: * <P>This class assumes that data is transferred in code-blocks, as defined
067: * by the 'CBlkWTDataSrc' interface. The internal calculation of the wavelet
068: * transform may be done differently but a buffering class should convert to
069: * that type of transfer.
070: * */
071: public abstract class ForwardWT extends ImgDataAdapter implements
072: ForwWT, CBlkWTDataSrc {
073:
074: /**
075: * ID for the dyadic wavelet tree decomposition (also called "Mallat" in
076: * JPEG 2000): 0x00.
077: * */
078: public final static int WT_DECOMP_DYADIC = 0;
079:
080: /** The prefix for wavelet transform options: 'W' */
081: public final static char OPT_PREFIX = 'W';
082:
083: /** The list of parameters that is accepted for wavelet transform. Options
084: * for the wavelet transform start with 'W'. */
085: private final static String[][] pinfo = {
086: {
087: "Wlev",
088: "<number of decomposition levels>",
089: "Specifies the number of wavelet decomposition levels to apply to "
090: + "the image. If 0 no wavelet transform is performed. All components "
091: + "and all tiles have the same number of decomposition levels.",
092: "5" },
093: {
094: "Wwt",
095: "[full]",
096: "Specifies the wavelet transform to be used. Possible value is: "
097: + "'full' (full page). The value 'full' performs a normal DWT.",
098: "full" }, };
099:
100: /**
101: * Initializes this object for the specified number of tiles 'nt' and
102: * components 'nc'.
103: *
104: * @param src The source of ImgData
105: * */
106: protected ForwardWT(ImgData src) {
107: super (src);
108: }
109:
110: /**
111: * Returns the parameters that are used in this class and implementing
112: * classes. It returns a 2D String array. Each of the 1D arrays is for a
113: * different option, and they have 3 elements. The first element is the
114: * option name, the second one is the synopsis and the third one is a long
115: * description of what the parameter is. The synopsis or description may
116: * be 'null', in which case it is assumed that there is no synopsis or
117: * description of the option, respectively. Null may be returned if no
118: * options are supported.
119: *
120: * @return the options name, their synopsis and their explanation, or null
121: * if no options are supported.
122: * */
123: public static String[][] getParameterInfo() {
124: return pinfo;
125: }
126:
127: /**
128: * Creates a ForwardWT object with the specified filters, and with other
129: * options specified in the parameter list 'pl'.
130: *
131: * @param src The source of data to be transformed
132: *
133: * @param pl The parameter list (or options).
134: *
135: * @param kers The encoder specifications.
136: *
137: * @return A new ForwardWT object with the specified filters and options
138: * from 'pl'.
139: *
140: * @exception IllegalArgumentException If mandatory parameters are missing
141: * or if invalid values are given.
142: * */
143: public static ForwardWT createInstance(BlkImgDataSrc src,
144: J2KImageWriteParamJava wp) {
145: int defdec, deflev;
146: String decompstr;
147: String wtstr;
148: String pstr;
149: StreamTokenizer stok;
150: StringTokenizer strtok;
151: int prefx, prefy; // Partitioning reference point coordinates
152: /*
153: // Check parameters
154: pl.checkList(OPT_PREFIX, pl.toNameArray(pinfo));
155: */
156:
157: deflev = ((Integer) wp.getDecompositionLevel().getDefault())
158: .intValue();
159:
160: // partition reference point
161: prefx = 0;
162: prefy = 0;
163:
164: return new ForwWTFull(src, wp, prefx, prefy);
165: }
166:
167: }
|