001/* 002 * $RCSfile: DecoderSpecs.java,v $ 003 * $Revision: 1.1 $ 004 * $Date: 2005/02/11 05:02:03 $ 005 * $State: Exp $ 006 * 007 * Class: DecoderSpecs 008 * 009 * Description: Hold all decoder specifications 010 * 011 * 012 * 013 * COPYRIGHT: 014 * 015 * This software module was originally developed by Raphaël Grosbois and 016 * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 017 * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 018 * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research 019 * Centre France S.A) in the course of development of the JPEG2000 020 * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 021 * software module is an implementation of a part of the JPEG 2000 022 * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 023 * Systems AB and Canon Research Centre France S.A (collectively JJ2000 024 * Partners) agree not to assert against ISO/IEC and users of the JPEG 025 * 2000 Standard (Users) any of their rights under the copyright, not 026 * including other intellectual property rights, for this software module 027 * with respect to the usage by ISO/IEC and Users of this software module 028 * or modifications thereof for use in hardware or software products 029 * claiming conformance to the JPEG 2000 Standard. Those intending to use 030 * this software module in hardware or software products are advised that 031 * their use may infringe existing patents. The original developers of 032 * this software module, JJ2000 Partners and ISO/IEC assume no liability 033 * for use of this software module or modifications thereof. No license 034 * or right to this software module is granted for non JPEG 2000 Standard 035 * conforming products. JJ2000 Partners have full right to use this 036 * software module for his/her own purpose, assign or donate this 037 * software module to any third party and to inhibit third parties from 038 * using this software module for non JPEG 2000 Standard conforming 039 * products. This copyright notice must be included in all copies or 040 * derivative works of this software module. 041 * 042 * Copyright (c) 1999/2000 JJ2000 Partners. 043 * */ 044package jj2000.j2k.decoder; 045 046import jj2000.j2k.IntegerSpec; 047import jj2000.j2k.ModuleSpec; 048import jj2000.j2k.entropy.CBlkSizeSpec; 049import jj2000.j2k.entropy.PrecinctSizeSpec; 050import jj2000.j2k.image.CompTransfSpec; 051import jj2000.j2k.quantization.GuardBitsSpec; 052import jj2000.j2k.quantization.QuantStepSizeSpec; 053import jj2000.j2k.quantization.QuantTypeSpec; 054import jj2000.j2k.roi.MaxShiftSpec; 055import jj2000.j2k.wavelet.synthesis.SynWTFilterSpec; 056 057/** 058 * This class holds references to each module specifications used in the 059 * decoding chain. This avoid big amount of arguments in method calls. A 060 * specification contains values of each tile-component for one module. All 061 * members must be instance of ModuleSpec class (or its children). 062 * 063 * @see ModuleSpec 064 * */ 065public class DecoderSpecs implements Cloneable { 066 067 /** ICC Profiling specifications */ 068 public ModuleSpec iccs; 069 070 /** ROI maxshift value specifications */ 071 public MaxShiftSpec rois; 072 073 /** Quantization type specifications */ 074 public QuantTypeSpec qts; 075 076 /** Quantization normalized base step size specifications */ 077 public QuantStepSizeSpec qsss; 078 079 /** Number of guard bits specifications */ 080 public GuardBitsSpec gbs; 081 082 /** Analysis wavelet filters specifications */ 083 public SynWTFilterSpec wfs; 084 085 /** Number of decomposition levels specifications */ 086 public IntegerSpec dls; 087 088 /** Number of layers specifications */ 089 public IntegerSpec nls; 090 091 /** Progression order specifications */ 092 public IntegerSpec pos; 093 094 /** The Entropy decoder options specifications */ 095 public ModuleSpec ecopts; 096 097 /** The component transformation specifications */ 098 public CompTransfSpec cts; 099 100 /** The progression changes specifications */ 101 public ModuleSpec pcs; 102 103 /** The error resilience specifications concerning the entropy 104 * decoder */ 105 public ModuleSpec ers; 106 107 /** Precinct partition specifications */ 108 public PrecinctSizeSpec pss; 109 110 /** The Start Of Packet (SOP) markers specifications */ 111 public ModuleSpec sops; 112 113 /** The End of Packet Headers (EPH) markers specifications */ 114 public ModuleSpec ephs; 115 116 /** Code-blocks sizes specification */ 117 public CBlkSizeSpec cblks; 118 119 /** Packed packet header specifications */ 120 public ModuleSpec pphs; 121 122 /** 123 * Returns a copy of the current object. 124 * */ 125 public DecoderSpecs getCopy() { 126 DecoderSpecs decSpec2; 127 try { 128 decSpec2 = (DecoderSpecs)this.clone(); 129 } catch (CloneNotSupportedException e) { 130 throw new Error("Cannot clone the DecoderSpecs instance"); 131 } 132 // Quantization 133 decSpec2.qts = (QuantTypeSpec)qts.getCopy(); 134 decSpec2.qsss = (QuantStepSizeSpec)qsss.getCopy(); 135 decSpec2.gbs = (GuardBitsSpec)gbs.getCopy(); 136 // Wavelet transform 137 decSpec2.wfs = (SynWTFilterSpec)wfs.getCopy(); 138 decSpec2.dls = (IntegerSpec)dls.getCopy(); 139 // Component transformation 140 decSpec2.cts = (CompTransfSpec)cts.getCopy(); 141 // ROI 142 if(rois!=null) { 143 decSpec2.rois = (MaxShiftSpec)rois.getCopy(); 144 } 145 return decSpec2; 146 } 147 148 149 /** 150 * Initialize all members with the given number of tiles and components. 151 * 152 * @param nt Number of tiles 153 * 154 * @param nc Number of components 155 * */ 156 public DecoderSpecs(int nt,int nc){ 157 // Quantization 158 qts = new QuantTypeSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP); 159 qsss = new QuantStepSizeSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP); 160 gbs = new GuardBitsSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP); 161 162 // Wavelet transform 163 wfs = new SynWTFilterSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP); 164 dls = new IntegerSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP); 165 166 // Component transformation 167 cts = new CompTransfSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP); 168 169 // Entropy decoder 170 ecopts = new ModuleSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP); 171 ers = new ModuleSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP); 172 cblks = new CBlkSizeSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP); 173 174 // Precinct partition 175 pss = new PrecinctSizeSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE_COMP,dls); 176 177 // Codestream 178 nls = new IntegerSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE); 179 pos = new IntegerSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE); 180 pcs = new ModuleSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE); 181 sops = new ModuleSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE); 182 ephs = new ModuleSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE); 183 pphs = new ModuleSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE); 184 iccs = new ModuleSpec(nt,nc,ModuleSpec.SPEC_TYPE_TILE); 185 pphs.setDefault(new Boolean(false)); 186 } 187}