001/* 002 * $RCSfile: MultiResImgData.java,v $ 003 * $Revision: 1.1 $ 004 * $Date: 2005/02/11 05:02:33 $ 005 * $State: Exp $ 006 * 007 * Class: MultiResImgData 008 * 009 * Description: The interface for classes that provide 010 * multi-resolution image data. 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 * 046 * 047 */ 048 049package jj2000.j2k.wavelet.synthesis; 050import java.awt.Point; 051import jj2000.j2k.image.*; 052 053/** 054 * This interface defines methods to access image attributes (width, height, 055 * number of components, etc.) of multiresolution images, such as those 056 * resulting from an inverse wavelet transform. The image can be tiled or not 057 * (i.e. if the image is not tiled then there is only 1 tile). It should be 058 * implemented by all classes that provide multi-resolution image data, such 059 * as entropy decoders, dequantizers, etc. This interface, however, does not 060 * define methods to transfer image data (i.e. pixel data), that is defined by 061 * other interfaces, such as 'CBlkQuantDataSrcDec'. 062 * 063 * <p>This interface is very similar to the 'ImgData' one. It differs only by 064 * the fact that it handles multiple resolutions.</p> 065 * 066 * <p>Resolution levels are counted from 0 to L. Resolution level 0 is the 067 * lower resolution, while L is the maximum resolution level, or full 068 * resolution, which is returned by 'getMaxResLvl()'. Note that there are L+1 069 * resolution levels available.</p> 070 * 071 * <p>As in the 'ImgData' interface a multi-resolution image lies on top of a 072 * canvas. The canvas coordinates are mapped from the full resolution 073 * reference grid (i.e. resolution level 'L' reference grid) to a resolution 074 * level 'l' reference grid by '(x_l,y_l) = 075 * (ceil(x_l/2^(L-l)),ceil(y_l/2^(L-l)))', where '(x,y)' are the full 076 * resolution reference grid coordinates and '(x_l,y_l)' are the level 'l' 077 * reference grid coordinates.</p> 078 * 079 * <p>For details on the canvas system and its implications consult the 080 * 'ImgData' interface.</p> 081 * 082 * <p>Note that tile sizes may not be obtained by simply dividing the tile 083 * size in the reference grid by the subsampling factor.</p> 084 * 085 * @see jj2000.j2k.image.ImgData 086 * 087 * @see jj2000.j2k.quantization.dequantizer.CBlkQuantDataSrcDec 088 * */ 089public interface MultiResImgData { 090 091 /** 092 * Returns the overall width of the current tile in pixels for the given 093 * resolution level. This is the tile's width without accounting for any 094 * component subsampling. The resolution level is indexed from the lowest 095 * number of resolution levels of all components of the current tile. 096 * 097 * @param rl The resolution level, from 0 to L. 098 * 099 * @return The total current tile's width in pixels. 100 * */ 101 public int getTileWidth(int rl); 102 103 /** 104 * Returns the overall height of the current tile in pixels, for the given 105 * resolution level. This is the tile's height without accounting for any 106 * component subsampling. The resolution level is indexed from the lowest 107 * number of resolution levels of all components of the current tile. 108 * 109 * @param rl The resolution level, from 0 to L. 110 * 111 * @return The total current tile's height in pixels. 112 * */ 113 public int getTileHeight(int rl); 114 115 /** Returns the nominal tiles width */ 116 public int getNomTileWidth(); 117 118 /** Returns the nominal tiles height */ 119 public int getNomTileHeight(); 120 121 /** 122 * Returns the overall width of the image in pixels, for the given 123 * resolution level. This is the image's width without accounting for any 124 * component subsampling or tiling. The resolution level is indexed from 125 * the lowest number of resolution levels of all components of the current 126 * tile. 127 * 128 * @param rl The resolution level, from 0 to L. 129 * 130 * @return The total image's width in pixels. 131 * */ 132 public int getImgWidth(int rl); 133 134 /** 135 * Returns the overall height of the image in pixels, for the given 136 * resolution level. This is the image's height without accounting for any 137 * component subsampling or tiling. The resolution level is indexed from 138 * the lowest number of resolution levels of all components of the current 139 * tile. 140 * 141 * @param rl The resolution level, from 0 to L. 142 * 143 * @return The total image's height in pixels. 144 * */ 145 public int getImgHeight(int rl); 146 147 /** 148 * Returns the number of components in the image. 149 * 150 * @return The number of components in the image. 151 * */ 152 public int getNumComps(); 153 154 /** 155 * Returns the component subsampling factor in the horizontal direction, 156 * for the specified component. This is, approximately, the ratio of 157 * dimensions between the reference grid and the component itself, see the 158 * 'ImgData' interface desription for details. 159 * 160 * @param c The index of the component (between 0 and N-1) 161 * 162 * @return The horizontal subsampling factor of component 'c' 163 * 164 * @see jj2000.j2k.image.ImgData 165 * */ 166 public int getCompSubsX(int c); 167 168 /** 169 * Returns the component subsampling factor in the vertical direction, for 170 * the specified component. This is, approximately, the ratio of 171 * dimensions between the reference grid and the component itself, see the 172 * 'ImgData' interface desription for details. 173 * 174 * @param c The index of the component (between 0 and N-1) 175 * 176 * @return The vertical subsampling factor of component 'c' 177 * 178 * @see jj2000.j2k.image.ImgData 179 * */ 180 public int getCompSubsY(int c); 181 182 /** 183 * Returns the width in pixels of the specified tile-component for the 184 * given resolution level. 185 * 186 * @param t Tile index 187 * 188 * @param c The index of the component, from 0 to N-1. 189 * 190 * @param rl The resolution level, from 0 to L. 191 * 192 * @return The width in pixels of component <tt>c</tt> in tile <tt>t</tt> 193 * for resolution <tt>rl</tt>. 194 * */ 195 public int getTileCompWidth(int t,int c,int rl); 196 197 /** 198 * Returns the height in pixels of the specified tile-component for the 199 * given resolution level. 200 * 201 * @param t The tile index. 202 * 203 * @param c The index of the component, from 0 to N-1. 204 * 205 * @param rl The resolution level, from 0 to L. 206 * 207 * @return The height in pixels of component <tt>c</tt> in tile 208 * <tt>t</tt>. 209 * */ 210 public int getTileCompHeight(int t,int c,int rl); 211 212 /** 213 * Returns the width in pixels of the specified component in the overall 214 * image, for the given resolution level. 215 * 216 * @param c The index of the component, from 0 to N-1. 217 * 218 * @param rl The resolution level, from 0 to L. 219 * 220 * @return The width in pixels of component <tt>c</tt> in the overall 221 * image. 222 * */ 223 public int getCompImgWidth(int c,int rl); 224 225 /** 226 * Returns the height in pixels of the specified component in the overall 227 * image, for the given resolution level. 228 * 229 * @param c The index of the component, from 0 to N-1. 230 * 231 * @param rl The resolution level, from 0 to L. 232 * 233 * @return The height in pixels of component <tt>n</tt> in the overall 234 * image. 235 * */ 236 public int getCompImgHeight(int n, int rl); 237 238 /** 239 * Changes the current tile, given the new indexes. An 240 * IllegalArgumentException is thrown if the indexes do not correspond to 241 * a valid tile. 242 * 243 * @param x The horizontal indexes the tile. 244 * 245 * @param y The vertical indexes of the new tile. 246 * */ 247 public void setTile(int x,int y); 248 249 /** 250 * Advances to the next tile, in standard scan-line order (by rows then 251 * columns). An NoNextElementException is thrown if the current tile is 252 * the last one (i.e. there is no next tile). 253 * */ 254 public void nextTile(); 255 256 /** 257 * Returns the indexes of the current tile. These are the horizontal and 258 * vertical indexes of the current tile. 259 * 260 * @param co If not null this object is used to return the information. If 261 * null a new one is created and returned. 262 * 263 * @return The current tile's indexes (vertical and horizontal indexes). 264 * */ 265 public Point getTile(Point co); 266 267 /** 268 * Returns the index of the current tile, relative to a standard scan-line 269 * order. 270 * 271 * @return The current tile's index (starts at 0). 272 * */ 273 public int getTileIdx(); 274 275 /** 276 * Returns the horizontal coordinate of the upper-left corner of the 277 * specified resolution in the given component of the current tile. 278 * 279 * @param c The component index. 280 * 281 * @param rl The resolution level index. 282 * */ 283 public int getResULX(int c,int rl); 284 285 /** 286 * Returns the vertical coordinate of the upper-left corner of the 287 * specified resolution in the given component of the current tile. 288 * 289 * @param c The component index. 290 * 291 * @param rl The resolution level index. 292 * */ 293 public int getResULY(int c,int rl); 294 295 /** 296 * Returns the horizontal coordinate of the image origin, the top-left 297 * corner, in the canvas system, on the reference grid at the specified 298 * resolution level. The resolution level is indexed from the lowest 299 * number of resolution levels of all components of the current tile. 300 * 301 * @param rl The resolution level, from 0 to L. 302 * 303 * @return The horizontal coordinate of the image origin in the canvas 304 * system, on the reference grid. 305 * */ 306 public int getImgULX(int rl); 307 308 /** 309 * Returns the vertical coordinate of the image origin, the top-left 310 * corner, in the canvas system, on the reference grid at the specified 311 * resolution level. The resolution level is indexed from the lowest 312 * number of resolution levels of all components of the current tile. 313 * 314 * @param rl The resolution level, from 0 to L. 315 * 316 * @return The vertical coordinate of the image origin in the canvas 317 * system, on the reference grid. 318 * */ 319 public int getImgULY(int rl); 320 321 /** Returns the horizontal tile partition offset in the reference grid */ 322 public int getTilePartULX(); 323 324 /** Returns the vertical tile partition offset in the reference grid */ 325 public int getTilePartULY(); 326 327 /** 328 * Returns the number of tiles in the horizontal and vertical directions. 329 * 330 * @param co If not null this object is used to return the information. If 331 * null a new one is created and returned. 332 * 333 * @return The number of tiles in the horizontal (Point.x) and vertical 334 * (Point.y) directions. 335 * */ 336 public Point getNumTiles(Point co); 337 338 /** 339 * Returns the total number of tiles in the image. 340 * 341 * @return The total number of tiles in the image. 342 * */ 343 public int getNumTiles(); 344 345 /** 346 * Returns the specified synthesis subband tree 347 * 348 * @param t Tile index. 349 * 350 * @param c Component index. 351 * */ 352 public SubbandSyn getSynSubbandTree(int t,int c); 353}