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 * */ 045package jj2000.j2k.wavelet.analysis; 046 047import java.io.StreamTokenizer; 048import java.util.StringTokenizer; 049 050import jj2000.j2k.image.BlkImgDataSrc; 051import jj2000.j2k.image.ImgData; 052import jj2000.j2k.image.ImgDataAdapter; 053 054import com.github.jaiimageio.jpeg2000.impl.J2KImageWriteParamJava; 055/** 056 * This abstract class represents the forward wavelet transform functional 057 * block. The functional block may actually be comprised of several classes 058 * linked together, but a subclass of this abstract class is the one that is 059 * returned as the functional block that performs the forward wavelet 060 * transform. 061 * 062 * <P>This class assumes that data is transferred in code-blocks, as defined 063 * by the 'CBlkWTDataSrc' interface. The internal calculation of the wavelet 064 * transform may be done differently but a buffering class should convert to 065 * that type of transfer. 066 * */ 067public abstract class ForwardWT extends ImgDataAdapter 068 implements ForwWT, CBlkWTDataSrc { 069 070 /** 071 * ID for the dyadic wavelet tree decomposition (also called "Mallat" in 072 * JPEG 2000): 0x00. 073 * */ 074 public final static int WT_DECOMP_DYADIC = 0; 075 076 /** The prefix for wavelet transform options: 'W' */ 077 public final static char OPT_PREFIX = 'W'; 078 079 /** The list of parameters that is accepted for wavelet transform. Options 080 * for the wavelet transform start with 'W'. */ 081 private final static String [][] pinfo = { 082 { "Wlev", "<number of decomposition levels>", 083 "Specifies the number of wavelet decomposition levels to apply to "+ 084 "the image. If 0 no wavelet transform is performed. All components "+ 085 "and all tiles have the same number of decomposition levels.","5"}, 086 { "Wwt", "[full]", 087 "Specifies the wavelet transform to be used. Possible value is: "+ 088 "'full' (full page). The value 'full' performs a normal DWT.", 089 "full"}, 090 }; 091 092 /** 093 * Initializes this object for the specified number of tiles 'nt' and 094 * components 'nc'. 095 * 096 * @param src The source of ImgData 097 * */ 098 protected ForwardWT(ImgData src) { 099 super(src); 100 } 101 102 /** 103 * Returns the parameters that are used in this class and implementing 104 * classes. It returns a 2D String array. Each of the 1D arrays is for a 105 * different option, and they have 3 elements. The first element is the 106 * option name, the second one is the synopsis and the third one is a long 107 * description of what the parameter is. The synopsis or description may 108 * be 'null', in which case it is assumed that there is no synopsis or 109 * description of the option, respectively. Null may be returned if no 110 * options are supported. 111 * 112 * @return the options name, their synopsis and their explanation, or null 113 * if no options are supported. 114 * */ 115 public static String[][] getParameterInfo() { 116 return pinfo; 117 } 118 119 /** 120 * Creates a ForwardWT object with the specified filters, and with other 121 * options specified in the parameter list 'pl'. 122 * 123 * @param src The source of data to be transformed 124 * 125 * @param pl The parameter list (or options). 126 * 127 * @param kers The encoder specifications. 128 * 129 * @return A new ForwardWT object with the specified filters and options 130 * from 'pl'. 131 * 132 * @exception IllegalArgumentException If mandatory parameters are missing 133 * or if invalid values are given. 134 * */ 135 public static ForwardWT createInstance(BlkImgDataSrc src, 136 J2KImageWriteParamJava wp){ 137 int defdec,deflev; 138 String decompstr; 139 String wtstr; 140 String pstr; 141 StreamTokenizer stok; 142 StringTokenizer strtok; 143 int prefx,prefy; // Partitioning reference point coordinates 144/* 145 // Check parameters 146 pl.checkList(OPT_PREFIX, pl.toNameArray(pinfo)); 147*/ 148 deflev = ((Integer)wp.getDecompositionLevel().getDefault()).intValue(); 149 150 // partition reference point 151 prefx = 0; 152 prefy = 0; 153 154 return new ForwWTFull(src, wp, prefx,prefy); 155 } 156 157}