Its purpose it is to ease the development and testing process. A 55 | * class that partially implements its functionality should throw a 56 | * NotImplementedError when a method that has not yet 57 | * been implemented is called. 58 | * 59 | *
This class is made a subclass of Error since it should 60 | * never be caught by an application. There is no need to declare this 61 | * exception in the throws clause of a method. 62 | * 63 | * @see Error 64 | */ 65 | public class NotImplementedError extends Error { 66 | 67 | /** 68 | * Constructs a new NotImplementedError exception with 69 | * the default detail message. The message is: 70 | * 71 | *
The called method has not been implemented yet. Sorry! 72 | * 73 | * 74 | */ 75 | public NotImplementedError() { 76 | super("The called method has not been implemented yet. Sorry!"); 77 | } 78 | 79 | /** 80 | * Constructs a new NotImplementedError exception with 81 | * the specified detail message m. 82 | * 83 | * @param m The detail message to use 84 | * 85 | * 86 | */ 87 | public NotImplementedError(String m) { 88 | super(m); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/jj2000/j2k/codestream/CBlkCoordInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: CBlkCoordInfo.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: CBlkCoordInfo 7 | * 8 | * Description: Used to store the code-blocks coordinates. 9 | * 10 | * 11 | * 12 | * COPYRIGHT: 13 | * 14 | * This software module was originally developed by Raphal Grosbois and 15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 18 | * Centre France S.A) in the course of development of the JPEG2000 19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 20 | * software module is an implementation of a part of the JPEG 2000 21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 24 | * 2000 Standard (Users) any of their rights under the copyright, not 25 | * including other intellectual property rights, for this software module 26 | * with respect to the usage by ISO/IEC and Users of this software module 27 | * or modifications thereof for use in hardware or software products 28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 29 | * this software module in hardware or software products are advised that 30 | * their use may infringe existing patents. The original developers of 31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 32 | * for use of this software module or modifications thereof. No license 33 | * or right to this software module is granted for non JPEG 2000 Standard 34 | * conforming products. JJ2000 Partners have full right to use this 35 | * software module for his/her own purpose, assign or donate this 36 | * software module to any third party and to inhibit third parties from 37 | * using this software module for non JPEG 2000 Standard conforming 38 | * products. This copyright notice must be included in all copies or 39 | * derivative works of this software module. 40 | * 41 | * Copyright (c) 1999/2000 JJ2000 Partners. 42 | * */ 43 | package jj2000.j2k.codestream; 44 | 45 | import jj2000.j2k.image.*; 46 | 47 | /** 48 | * This class is used to store the coordinates of code-blocks. 49 | * */ 50 | public class CBlkCoordInfo extends CoordInfo { 51 | 52 | /** The code-block horizontal and vertical indexes */ 53 | public Coord idx; 54 | 55 | /** 56 | * Constructor. Creates a CBlkCoordInfo object. 57 | * */ 58 | public CBlkCoordInfo() { 59 | this.idx = new Coord(); 60 | } 61 | 62 | /** 63 | * Constructor. Creates a CBlkCoordInfo object width specified code-block 64 | * vertical and horizontal indexes. 65 | * 66 | * @param m Code-block vertical index. 67 | * 68 | * @param n Code-block horizontal index. 69 | * */ 70 | public CBlkCoordInfo(int m,int n) { 71 | this.idx = new Coord(n,m); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/jj2000/j2k/codestream/CoordInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: CoordInfo.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: CoordInfo 7 | * 8 | * Description: Used to store the coordinates of code-blocks/packets 9 | * 10 | * 11 | * 12 | * COPYRIGHT: 13 | * 14 | * This software module was originally developed by Raphal Grosbois and 15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 18 | * Centre France S.A) in the course of development of the JPEG2000 19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 20 | * software module is an implementation of a part of the JPEG 2000 21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 24 | * 2000 Standard (Users) any of their rights under the copyright, not 25 | * including other intellectual property rights, for this software module 26 | * with respect to the usage by ISO/IEC and Users of this software module 27 | * or modifications thereof for use in hardware or software products 28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 29 | * this software module in hardware or software products are advised that 30 | * their use may infringe existing patents. The original developers of 31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 32 | * for use of this software module or modifications thereof. No license 33 | * or right to this software module is granted for non JPEG 2000 Standard 34 | * conforming products. JJ2000 Partners have full right to use this 35 | * software module for his/her own purpose, assign or donate this 36 | * software module to any third party and to inhibit third parties from 37 | * using this software module for non JPEG 2000 Standard conforming 38 | * products. This copyright notice must be included in all copies or 39 | * derivative works of this software module. 40 | * 41 | * Copyright (c) 1999/2000 JJ2000 Partners. 42 | * */ 43 | package jj2000.j2k.codestream; 44 | 45 | /** 46 | * This class is used to store the coordinates of objects such as code-blocks 47 | * or precincts. As this is an abstract class, it cannot be used directly but 48 | * derived classes have been created for code-blocks and packets 49 | * (CBlkCoordInfo and PrecCoordInfo). 50 | * 51 | * @see PrecCoordInfo 52 | * @see CBlkCoordInfo 53 | * */ 54 | public abstract class CoordInfo { 55 | 56 | /** Horizontal upper left coordinate in the subband */ 57 | public int ulx; 58 | 59 | /** Vertical upper left coordinate in the subband */ 60 | public int uly; 61 | 62 | /** Object's width */ 63 | public int w; 64 | 65 | /** Object's height */ 66 | public int h; 67 | 68 | /** 69 | * Constructor. Creates a CoordInfo object. 70 | * 71 | * @param ulx The horizontal upper left coordinate in the subband 72 | * 73 | * @param uly The vertical upper left coordinate in the subband 74 | * 75 | * @param w The width 76 | * 77 | * @param h The height 78 | * 79 | * @param idx The object's index 80 | * */ 81 | public CoordInfo(int ulx, int uly, int w, int h) { 82 | this.ulx = ulx; 83 | this.uly = uly; 84 | this.w = w; 85 | this.h = h; 86 | } 87 | 88 | /** Empty contructor */ 89 | public CoordInfo() { } 90 | } 91 | -------------------------------------------------------------------------------- /src/jj2000/j2k/codestream/CorruptedCodestreamException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: CorruptedCodestreamException.java,v 1.6 2000/09/05 09:22:33 grosbois 5 | * Exp $ 6 | * 7 | * Class: CorruptedCodestreamException 8 | * 9 | * Description: Exception thrown when illegal bit stream 10 | * values are decoded. 11 | * 12 | * 13 | * 14 | * COPYRIGHT: 15 | * 16 | * This software module was originally developed by Raphal Grosbois and 17 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 18 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 19 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 20 | * Centre France S.A) in the course of development of the JPEG2000 21 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 22 | * software module is an implementation of a part of the JPEG 2000 23 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 24 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 25 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 26 | * 2000 Standard (Users) any of their rights under the copyright, not 27 | * including other intellectual property rights, for this software module 28 | * with respect to the usage by ISO/IEC and Users of this software module 29 | * or modifications thereof for use in hardware or software products 30 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 31 | * this software module in hardware or software products are advised that 32 | * their use may infringe existing patents. The original developers of 33 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 34 | * for use of this software module or modifications thereof. No license 35 | * or right to this software module is granted for non JPEG 2000 Standard 36 | * conforming products. JJ2000 Partners have full right to use this 37 | * software module for his/her own purpose, assign or donate this 38 | * software module to any third party and to inhibit third parties from 39 | * using this software module for non JPEG 2000 Standard conforming 40 | * products. This copyright notice must be included in all copies or 41 | * derivative works of this software module. 42 | * 43 | * Copyright (c) 1999/2000 JJ2000 Partners. 44 | * */ 45 | package jj2000.j2k.codestream; 46 | 47 | import java.io.*; 48 | 49 | /** 50 | * This exception is thrown whenever an illegal value is read from a bit 51 | * stream. The cause can be either a corrupted bit stream, or a a bit stream 52 | * which is illegal. 53 | * */ 54 | public class CorruptedCodestreamException extends IOException { 55 | 56 | /** 57 | * Constructs a new CorruptedCodestreamException exception with 58 | * no detail message. 59 | * */ 60 | public CorruptedCodestreamException() { 61 | super(); 62 | } 63 | 64 | /** 65 | * Constructs a new CorruptedCodestreamException exception with 66 | * the specified detail message. 67 | * 68 | * @param s The detail message. 69 | * */ 70 | public CorruptedCodestreamException(String s) { 71 | super(s); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/jj2000/j2k/codestream/PrecInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: PrecInfo.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: PrecInfo 7 | * 8 | * Description: Keeps information about a precinct 9 | * 10 | * COPYRIGHT: 11 | * 12 | * This software module was originally developed by Raphal Grosbois and 13 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 14 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 15 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 16 | * Centre France S.A) in the course of development of the JPEG2000 17 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 18 | * software module is an implementation of a part of the JPEG 2000 19 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 20 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 21 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 22 | * 2000 Standard (Users) any of their rights under the copyright, not 23 | * including other intellectual property rights, for this software module 24 | * with respect to the usage by ISO/IEC and Users of this software module 25 | * or modifications thereof for use in hardware or software products 26 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 27 | * this software module in hardware or software products are advised that 28 | * their use may infringe existing patents. The original developers of 29 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 30 | * for use of this software module or modifications thereof. No license 31 | * or right to this software module is granted for non JPEG 2000 Standard 32 | * conforming products. JJ2000 Partners have full right to use this 33 | * software module for his/her own purpose, assign or donate this 34 | * software module to any third party and to inhibit third parties from 35 | * using this software module for non JPEG 2000 Standard conforming 36 | * products. This copyright notice must be included in all copies or 37 | * derivative works of this software module. 38 | * 39 | * Copyright (c) 1999/2000 JJ2000 Partners. 40 | * */ 41 | package jj2000.j2k.codestream; 42 | 43 | /** 44 | * Class that holds precinct coordinates and references to contained 45 | * code-blocks in each subband. 46 | * */ 47 | public class PrecInfo { 48 | 49 | /** Precinct horizontal upper-left coordinate in the reference grid */ 50 | public int rgulx; 51 | 52 | /** Precinct vertical upper-left coordinate in the reference grid */ 53 | public int rguly; 54 | 55 | /** Precinct width reported in the reference grid */ 56 | public int rgw; 57 | 58 | /** Precinct height reported in the reference grid */ 59 | public int rgh; 60 | 61 | /** Precinct horizontal upper-left coordinate in the corresponding 62 | * resolution level*/ 63 | public int ulx; 64 | 65 | /** Precinct vertical upper-left coordinate in the corresponding 66 | * resolution level*/ 67 | public int uly; 68 | 69 | /** Precinct width in the corresponding resolution level */ 70 | public int w; 71 | 72 | /** Precinct height in the corresponding resolution level */ 73 | public int h; 74 | 75 | /** Resolution level index */ 76 | public int r; 77 | 78 | /** Code-blocks belonging to this precinct in each subbands of the 79 | * resolution level */ 80 | public CBlkCoordInfo[][][] cblk; 81 | 82 | /** Number of code-blocks in each subband belonging to this precinct */ 83 | public int[] nblk; 84 | 85 | /** 86 | * Class constructor. 87 | * 88 | * @param r Resolution level index. 89 | * @param ulx Precinct horizontal offset. 90 | * @param uly Precinct vertical offset. 91 | * @param w Precinct width. 92 | * @param h Precinct height. 93 | * @param rgulx Precinct horizontal offset in the image reference grid. 94 | * @param rguly Precinct horizontal offset in the image reference grid. 95 | * @param rgw Precinct width in the reference grid. 96 | * @param rgh Precinct height in the reference grid. 97 | * */ 98 | public PrecInfo(int r,int ulx,int uly,int w,int h,int rgulx,int rguly, 99 | int rgw,int rgh) { 100 | this.r = r; 101 | this.ulx = ulx; 102 | this.uly = uly; 103 | this.w = w; 104 | this.h = h; 105 | this.rgulx = rgulx; 106 | this.rguly = rguly; 107 | this.rgw = rgw; 108 | this.rgh = rgh; 109 | 110 | if (r==0) { 111 | cblk = new CBlkCoordInfo[1][][]; 112 | nblk = new int[1]; 113 | } else { 114 | cblk = new CBlkCoordInfo[4][][]; 115 | nblk = new int[4]; 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/jj2000/j2k/codestream/ProgressionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: ProgressionType.java 166 2012-01-11 23:48:05Z mroland $ 5 | * 6 | * Class: ProgressionType 7 | * 8 | * Description: The definition of the different bit stream 9 | * profiles. 10 | * 11 | * 12 | * 13 | * COPYRIGHT: 14 | * 15 | * This software module was originally developed by Raphal Grosbois and 16 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 17 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 18 | * Bouchard, Flix 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 | package jj2000.j2k.codestream; 45 | 46 | /** 47 | * This interface defines the identifiers for the different codestream 48 | * profiles and progression types. 49 | * 50 | *
Each progressive type has a different number: 'LY_RES_COMP_POS_PROG', 51 | * 'RES_LY_COMP_POS_PROG', 'RES_POS_COMP_LY_PROG', 'POS_COMP_RES_LY_PROG' or 52 | * 'COMP_POS_RES_LY_PROG'. These are the same identifiers are used in the 53 | * codestream syntax. 54 | * 55 | *
This interface defines the constants only. In order to use the constants 56 | * in any other class you can either use the fully qualified name (e.g., 57 | * ProgressionType.LY_RES_COMP_POS_PROG) or declare this interface in 58 | * the implements clause of the class and then access the identifier 59 | * directly.
60 | * */ 61 | public interface ProgressionType { 62 | 63 | /** The codestream is Layer/Resolution/Component/Position progressive : 0 64 | * */ 65 | public final static int LY_RES_COMP_POS_PROG = 0; 66 | 67 | /** The codestream is Resolution/Layer/Component/Position progressive : 1 68 | * */ 69 | public final static int RES_LY_COMP_POS_PROG = 1; 70 | 71 | /** The codestream is Resolution/Position/Component/Layer progressive : 2 72 | * */ 73 | public final static int RES_POS_COMP_LY_PROG = 2; 74 | 75 | /** The codestream is Position/Component/Resolution/Layer progressive : 3 76 | * */ 77 | public final static int POS_COMP_RES_LY_PROG = 3; 78 | 79 | /** The codestream is Component/Position/Resolution/Layer progressive : 4 80 | * */ 81 | public final static int COMP_POS_RES_LY_PROG = 4; 82 | } 83 | -------------------------------------------------------------------------------- /src/jj2000/j2k/codestream/reader/CBlkInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: CBlkInfo.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: CBlkInfo 7 | * 8 | * Description: Object containing code-block informations. 9 | * 10 | * 11 | * 12 | * COPYRIGHT: 13 | * 14 | * This software module was originally developed by Raphal Grosbois and 15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 18 | * Centre France S.A) in the course of development of the JPEG2000 19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 20 | * software module is an implementation of a part of the JPEG 2000 21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 24 | * 2000 Standard (Users) any of their rights under the copyright, not 25 | * including other intellectual property rights, for this software module 26 | * with respect to the usage by ISO/IEC and Users of this software module 27 | * or modifications thereof for use in hardware or software products 28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 29 | * this software module in hardware or software products are advised that 30 | * their use may infringe existing patents. The original developers of 31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 32 | * for use of this software module or modifications thereof. No license 33 | * or right to this software module is granted for non JPEG 2000 Standard 34 | * conforming products. JJ2000 Partners have full right to use this 35 | * software module for his/her own purpose, assign or donate this 36 | * software module to any third party and to inhibit third parties from 37 | * using this software module for non JPEG 2000 Standard conforming 38 | * products. This copyright notice must be included in all copies or 39 | * derivative works of this software module. 40 | * 41 | * Copyright (c) 1999/2000 JJ2000 Partners. 42 | * */ 43 | package jj2000.j2k.codestream.reader; 44 | 45 | /** 46 | * This class contains location of code-blocks' piece of codewords (there is 47 | * one piece per layer) and some other information. 48 | * */ 49 | public class CBlkInfo { 50 | 51 | /** Upper-left x-coordinate of the code-block (relative to the tile) */ 52 | public int ulx; 53 | 54 | /** Upper-left y-coordinate of the code-block (relative to the tile) */ 55 | public int uly; 56 | 57 | /** Width of the code-block */ 58 | public int w; 59 | 60 | /** Height of the code-block */ 61 | public int h; 62 | 63 | /** The number of most significant bits which are skipped for this 64 | * code-block (= Mb-1-bitDepth). */ 65 | public int msbSkipped; 66 | 67 | /** Length of each piece of code-block's codewords */ 68 | public int[] len; 69 | 70 | /** Offset of each piece of code-block's codewords in the file */ 71 | public int[] off; 72 | 73 | /** The number of truncation point for each layer */ 74 | public int[] ntp; 75 | 76 | /** The cumulative number of truncation points */ 77 | public int ctp; 78 | 79 | /** The length of each segment (used with regular termination or in 80 | * selective arithmetic bypass coding mode) */ 81 | public int[][] segLen; 82 | 83 | /** Index of the packet where each layer has been found */ 84 | public int[] pktIdx; 85 | 86 | /** 87 | * Constructs a new instance with specified number of layers and 88 | * code-block coordinates. The number corresponds to the maximum piece of 89 | * codeword for one code-block. 90 | * 91 | * @param ulx The uper-left x-coordinate 92 | * 93 | * @param uly The uper-left y-coordinate 94 | * 95 | * @param w Width of the code-block 96 | * 97 | * @param h Height of the code-block 98 | * 99 | * @param nl The number of layers 100 | * */ 101 | public CBlkInfo(int ulx,int uly,int w,int h,int nl) { 102 | this.ulx = ulx; 103 | this.uly = uly; 104 | this.w = w; 105 | this.h = h; 106 | off = new int[nl]; 107 | len = new int[nl]; 108 | ntp = new int[nl]; 109 | segLen = new int[nl][]; 110 | pktIdx = new int[nl]; 111 | for(int i=nl-1;i>=0;i--) { 112 | pktIdx[i] = -1; 113 | } 114 | } 115 | 116 | /** 117 | * Adds the number of new truncation for specified layer. 118 | * 119 | * @param l layer index 120 | * 121 | * @param newtp Number of new truncation points 122 | * */ 123 | public void addNTP(int l,int newtp){ 124 | ntp[l] = newtp; 125 | ctp = 0; 126 | for(int lIdx=0; lIdx<=l; lIdx++){ 127 | ctp += ntp[lIdx]; 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/jj2000/j2k/entropy/CodedCBlk.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: CodedCBlk.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: CodedCBlk 7 | * 8 | * Description: The generic coded (compressed) code-block 9 | * 10 | * 11 | * 12 | * COPYRIGHT: 13 | * 14 | * This software module was originally developed by Raphal Grosbois and 15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 18 | * Centre France S.A) in the course of development of the JPEG2000 19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 20 | * software module is an implementation of a part of the JPEG 2000 21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 24 | * 2000 Standard (Users) any of their rights under the copyright, not 25 | * including other intellectual property rights, for this software module 26 | * with respect to the usage by ISO/IEC and Users of this software module 27 | * or modifications thereof for use in hardware or software products 28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 29 | * this software module in hardware or software products are advised that 30 | * their use may infringe existing patents. The original developers of 31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 32 | * for use of this software module or modifications thereof. No license 33 | * or right to this software module is granted for non JPEG 2000 Standard 34 | * conforming products. JJ2000 Partners have full right to use this 35 | * software module for his/her own purpose, assign or donate this 36 | * software module to any third party and to inhibit third parties from 37 | * using this software module for non JPEG 2000 Standard conforming 38 | * products. This copyright notice must be included in all copies or 39 | * derivative works of this software module. 40 | * 41 | * Copyright (c) 1999/2000 JJ2000 Partners. 42 | * */ 43 | package jj2000.j2k.entropy; 44 | 45 | /** 46 | * This is the generic class to store coded (compressed) code-block. It stores 47 | * the compressed data as well as the necessary side-information. 48 | * 49 | *This class is normally not used. Instead the EncRDCBlk, EncLyrdCBlk and 50 | * the DecLyrdCBlk subclasses are used.
51 | * 52 | * @see jj2000.j2k.entropy.encoder.CBlkRateDistStats 53 | * @see jj2000.j2k.entropy.decoder.DecLyrdCBlk 54 | * */ 55 | public class CodedCBlk { 56 | 57 | /** The horizontal index of the code-block, within the subband. */ 58 | public int n; 59 | 60 | /** The vertical index of the code-block, within the subband. */ 61 | public int m; 62 | 63 | /** The number of skipped most significant bit-planes. */ 64 | public int skipMSBP; 65 | 66 | /** The compressed data */ 67 | public byte data[]; 68 | 69 | /** 70 | * Creates a new CodedCBlk object wit the default values and without 71 | * allocating any space for its members. 72 | * */ 73 | public CodedCBlk() { } 74 | 75 | /** 76 | * Creates a new CodedCBlk object with the specified values. 77 | * 78 | * @param m The horizontal index of the code-block, within the subband. 79 | * 80 | * @param n The vertical index of the code-block, within the subband. 81 | * 82 | * @param skipMSBP The number of skipped most significant bit-planes for 83 | * this code-block. 84 | * 85 | * @param data The compressed data. This array is referenced by this 86 | * object so it should not be modified after. 87 | * */ 88 | public CodedCBlk(int m, int n, int skipMSBP, byte data[]) { 89 | this.m = m; 90 | this.n = n; 91 | this.skipMSBP = skipMSBP; 92 | this.data = data; 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /src/jj2000/j2k/entropy/StdEntropyCoderOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: StdEntropyCoderOptions.java 166 2012-01-11 23:48:05Z mroland $ 5 | * 6 | * Class: StdEntropyCoderOptions 7 | * 8 | * Description: Entropy coding engine of stripes in 9 | * code-blocks options 10 | * 11 | * 12 | * 13 | * COPYRIGHT: 14 | * 15 | * This software module was originally developed by Raphal Grosbois and 16 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 17 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 18 | * Bouchard, Flix 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 | 45 | 46 | package jj2000.j2k.entropy; 47 | 48 | /** 49 | * This interface define the constants that identify the possible options for 50 | * the entropy coder, as well some fixed parameters of the JPEG 2000 entropy 51 | * coder. 52 | * */ 53 | public interface StdEntropyCoderOptions{ 54 | 55 | /** The flag bit to indicate that selective arithmetic coding bypass 56 | * should be used. In this mode, the significance propagation and 57 | * magnitude refinement passes bypass the arithmetic encoder in the fourth 58 | * bit-plane and latter ones (but not the cleanup pass). Note that the 59 | * transition between raw and AC segments needs terminations (whether or 60 | * not OPT_TERM_PASS is used). */ 61 | public final static int OPT_BYPASS = 1; 62 | 63 | /** The flag bit to indicate that the MQ states for all contexts should be 64 | * reset at the end of each (non-bypassed) coding pass. */ 65 | public final static int OPT_RESET_MQ = 1<<1; 66 | 67 | /** The flag bit to indicate that a termination should be performed after 68 | * each coding pass. Note that terminations are applied to both * * 69 | * arithmetically coded and bypassed (i.e. raw) passes . */ 70 | public final static int OPT_TERM_PASS = 1<<2; 71 | 72 | /** The flag bit to indicate the vertically stripe-causal context 73 | * formation should be used. */ 74 | public final static int OPT_VERT_STR_CAUSAL = 1<<3; 75 | 76 | /** The flag bit to indicate that error resilience info is embedded on MQ 77 | * termination. This corresponds to the predictable termination described 78 | * in Annex D.4.2 of the FDIS */ 79 | public final static int OPT_PRED_TERM = 1<<4; 80 | 81 | /** The flag bit to indicate that an error resilience segmentation symbol 82 | * is to be inserted at the end of each cleanup coding pass. The 83 | * segmentation symbol is the four symbol sequence 1010 that are sent 84 | * through the MQ coder using the UNIFORM context (as explained in annex 85 | * D.5 of FDIS). */ 86 | public final static int OPT_SEG_SYMBOLS = 1<<5; 87 | 88 | /** The minimum code-block dimension. The nominal width or height of a 89 | * code-block must never be less than this. It is 4. */ 90 | public static final int MIN_CB_DIM = 4; 91 | 92 | /** The maximum code-block dimension. No code-block should be larger, 93 | * either in width or height, than this value. It is 1024. */ 94 | public static final int MAX_CB_DIM = 1024; 95 | 96 | /** The maximum code-block area (width x height). The surface covered by 97 | * a nominal size block should never be larger than this. It is 4096 */ 98 | public static final int MAX_CB_AREA = 4096; 99 | 100 | /** The stripe height. This is the nominal value of the stripe height. It 101 | * is 4. */ 102 | public static final int STRIPE_HEIGHT = 4; 103 | 104 | /** The number of coding passes per bit-plane. This is the number of 105 | * passes per bit-plane. It is 3. */ 106 | public static final int NUM_PASSES = 3; 107 | 108 | /** The number of most significant bit-planes where bypass mode is not to 109 | * be used, even if bypass mode is on: 4. */ 110 | public static final int NUM_NON_BYPASS_MS_BP = 4; 111 | 112 | /** The number of empty passes in the most significant bit-plane. It is 113 | 2. */ 114 | public static final int NUM_EMPTY_PASSES_IN_MS_BP = 2; 115 | 116 | /** The index of the first "raw" pass, if bypass mode is on. */ 117 | public static final int FIRST_BYPASS_PASS_IDX = 118 | NUM_PASSES*NUM_NON_BYPASS_MS_BP-NUM_EMPTY_PASSES_IN_MS_BP; 119 | 120 | } 121 | -------------------------------------------------------------------------------- /src/jj2000/j2k/entropy/decoder/CodedCBlkDataSrcDec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: CodedCBlkDataSrcDec.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: CodedCBlkDataSrcDec 7 | * 8 | * Description: Interface that defines a source of entropy coded 9 | * data that is transferred in a code-block by 10 | * code-block basis (decoder side). 11 | * 12 | * 13 | * 14 | * COPYRIGHT: 15 | * 16 | * This software module was originally developed by Raphal Grosbois and 17 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 18 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 19 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 20 | * Centre France S.A) in the course of development of the JPEG2000 21 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 22 | * software module is an implementation of a part of the JPEG 2000 23 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 24 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 25 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 26 | * 2000 Standard (Users) any of their rights under the copyright, not 27 | * including other intellectual property rights, for this software module 28 | * with respect to the usage by ISO/IEC and Users of this software module 29 | * or modifications thereof for use in hardware or software products 30 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 31 | * this software module in hardware or software products are advised that 32 | * their use may infringe existing patents. The original developers of 33 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 34 | * for use of this software module or modifications thereof. No license 35 | * or right to this software module is granted for non JPEG 2000 Standard 36 | * conforming products. JJ2000 Partners have full right to use this 37 | * software module for his/her own purpose, assign or donate this 38 | * software module to any third party and to inhibit third parties from 39 | * using this software module for non JPEG 2000 Standard conforming 40 | * products. This copyright notice must be included in all copies or 41 | * derivative works of this software module. 42 | * 43 | * Copyright (c) 1999/2000 JJ2000 Partners. 44 | * */ 45 | package jj2000.j2k.entropy.decoder; 46 | 47 | import jj2000.j2k.wavelet.synthesis.*; 48 | 49 | /** 50 | * This interface defines a source of entropy coded data and methods to 51 | * transfer it in a code-block by code-block basis. In each call to 52 | * 'geCodeBlock()' a specified coded code-block is returned. 53 | * 54 | *This interface is the source of data for the entropy decoder. See the 55 | * 'EntropyDecoder' class.
56 | * 57 | *For each coded-code-block the entropy-coded data is returned along with 58 | * its truncation point information in a 'DecLyrdCBlk' object.
59 | * 60 | * @see EntropyDecoder 61 | * 62 | * @see DecLyrdCBlk 63 | * 64 | * @see jj2000.j2k.codestream.reader.BitstreamReaderAgent 65 | * */ 66 | public interface CodedCBlkDataSrcDec extends InvWTData { 67 | 68 | /** 69 | * Returns the specified coded code-block, for the specified component, in 70 | * the current tile. The first layer to return is indicated by 'fl'. The 71 | * number of layers that is returned depends on 'nl' and the amount of 72 | * data available. 73 | * 74 | *The argument 'fl' is to be used by subsequent calls to this method 75 | * for the same code-block. In this way supplamental data can be retrieved 76 | * at a later time. The fact that data from more than one layer can be 77 | * returned means that several packets from the same code-block, of the 78 | * same component, and the same tile, have been concatenated.
79 | * 80 | *The returned compressed code-block can have its progressive 81 | * attribute set. If this attribute is set it means that more data can be 82 | * obtained by subsequent calls to this method (subject to transmission 83 | * delays, etc). If the progressive attribute is not set it means that the 84 | * returned data is all the data that can be obtained for the specified 85 | * subblock.
86 | * 87 | *The compressed code-block is uniquely specified by the current tile, 88 | * the component (identified by 'c'), the subband (indentified by 'sb') 89 | * and the code-bock vertical and horizontal indexes 'm' and 'n'.
90 | * 91 | *The 'ulx' and 'uly' members of the returned 'DecLyrdCBlk' object 92 | * contain the coordinates of the top-left corner of the block, with 93 | * respect to the tile, not the subband.
94 | * 95 | * @param c The index of the component, from 0 to N-1. 96 | * 97 | * @param m The vertical index of the code-block to return, in the 98 | * specified subband. 99 | * 100 | * @param n The horizontal index of the code-block to return, in the 101 | * specified subband. 102 | * 103 | * @param sb The subband in whic the requested code-block is. 104 | * 105 | * @param fl The first layer to return. 106 | * 107 | * @param nl The number of layers to return, if negative all available 108 | * layers are returned, starting at 'fl'. 109 | * 110 | * @param ccb If not null this object is used to return the compressed 111 | * code-block. If null a new object is created and returned. If the data 112 | * array in ccb is not null then it can be reused to return the compressed 113 | * data. 114 | * 115 | * @return The compressed code-block, with a certain number of layers 116 | * determined by the available data and 'nl'. 117 | * */ 118 | public DecLyrdCBlk getCodeBlock(int c, int m, int n, 119 | SubbandSyn sb, int fl, int nl, 120 | DecLyrdCBlk ccb); 121 | } 122 | -------------------------------------------------------------------------------- /src/jj2000/j2k/entropy/decoder/DecLyrdCBlk.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: DecLyrdCBlk.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: DecLyrdCBlk 7 | * 8 | * Description: The coded (compressed) code-block 9 | * with layered organization for the decoder. 10 | * 11 | * 12 | * 13 | * COPYRIGHT: 14 | * 15 | * This software module was originally developed by Raphal Grosbois and 16 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 17 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 18 | * Bouchard, Flix 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 | package jj2000.j2k.entropy.decoder; 45 | 46 | import jj2000.j2k.entropy.*; 47 | 48 | /** 49 | * This class stores coded (compressed) code-blocks that are organized in 50 | * layers. This object can contain either all code-block data (i.e. all 51 | * layers), or a subset of all the layers that make up the whole compressed 52 | * code-block. It is applicable to the decoder engine only. Some data of the 53 | * coded-block is stored in the super class, see CodedCBlk. 54 | * 55 | *A code-block may have its progressive attribute set (i.e. the 'prog' 56 | * flag is true). If a code-block is progressive then it means that more data 57 | * for it may be obtained for an improved quality. If the progressive flag is 58 | * false then no more data is available from the source for this 59 | * code-block.
60 | * 61 | * @see CodedCBlk 62 | * */ 63 | public class DecLyrdCBlk extends CodedCBlk { 64 | 65 | /** The horizontal coordinate of the upper-left corner of the code-block */ 66 | public int ulx; 67 | 68 | /** The vertical coordinate of the upper left corner of the code-block */ 69 | public int uly; 70 | 71 | /** The width of the code-block */ 72 | public int w; 73 | 74 | /** The height of the code-block */ 75 | public int h; 76 | 77 | /** The coded (compressed) data length. The data is stored in the 'data' 78 | * array (see super class). */ 79 | public int dl; 80 | 81 | /** The progressive flag, false by default (see above). */ 82 | public boolean prog; 83 | 84 | /** The number of layers in the coded data. */ 85 | public int nl; 86 | 87 | /** The index of the first truncation point returned */ 88 | public int ftpIdx; 89 | 90 | /** The total number of truncation points from layer 1 to the last one in 91 | * this object. The number of truncation points in 'data' is 92 | * 'nTrunc-ftpIdx'. */ 93 | public int nTrunc; 94 | 95 | /** The length of each terminated segment. If null then there is only one 96 | * terminated segment, and its length is 'dl'. The number of terminated 97 | * segments is to be deduced from 'ftpIdx', 'nTrunc' and the coding 98 | * options. This array contains all terminated segments from the 'ftpIdx' 99 | * truncation point, upto, and including, the 'nTrunc-1' truncation 100 | * point. Any data after 'nTrunc-1' is not included in any length. */ 101 | public int tsLengths[]; 102 | } 103 | -------------------------------------------------------------------------------- /src/jj2000/j2k/fileformat/FileFormatBoxes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * cvs identifier: 3 | * 4 | * $Id: FileFormatBoxes.java 166 2012-01-11 23:48:05Z mroland $ 5 | * 6 | * Class: FileFormatMarkers 7 | * 8 | * Description: Contains definitions of boxes used in jp2 files 9 | * 10 | * 11 | * 12 | * COPYRIGHT: 13 | * 14 | * This software module was originally developed by Raphal Grosbois and 15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 18 | * Centre France S.A) in the course of development of the JPEG2000 19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 20 | * software module is an implementation of a part of the JPEG 2000 21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 24 | * 2000 Standard (Users) any of their rights under the copyright, not 25 | * including other intellectual property rights, for this software module 26 | * with respect to the usage by ISO/IEC and Users of this software module 27 | * or modifications thereof for use in hardware or software products 28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 29 | * this software module in hardware or software products are advised that 30 | * their use may infringe existing patents. The original developers of 31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 32 | * for use of this software module or modifications thereof. No license 33 | * or right to this software module is granted for non JPEG 2000 Standard 34 | * conforming products. JJ2000 Partners have full right to use this 35 | * software module for his/her own purpose, assign or donate this 36 | * software module to any third party and to inhibit third parties from 37 | * using this software module for non JPEG 2000 Standard conforming 38 | * products. This copyright notice must be included in all copies or 39 | * derivative works of this software module. 40 | * 41 | * Copyright (c) 1999/2000 JJ2000 Partners. 42 | * 43 | * 44 | * 45 | */ 46 | package jj2000.j2k.fileformat; 47 | 48 | 49 | /** 50 | * This class contains all the markers used in the JPEG 2000 Part I file format 51 | * 52 | * @see jj2000.j2k.fileformat.writer.FileFormatWriter 53 | * 54 | * @see jj2000.j2k.fileformat.reader.FileFormatReader 55 | * 56 | */ 57 | public interface FileFormatBoxes{ 58 | 59 | /**** Main boxes ****/ 60 | 61 | public static final int JP2_SIGNATURE_BOX = 0x6a502020; 62 | 63 | public static final int FILE_TYPE_BOX = 0x66747970; 64 | 65 | public static final int JP2_HEADER_BOX = 0x6a703268; 66 | 67 | public static final int CONTIGUOUS_CODESTREAM_BOX = 0x6a703263; 68 | 69 | public static final int INTELLECTUAL_PROPERTY_BOX = 0x64703269; 70 | 71 | public static final int XML_BOX = 0x786d6c20; 72 | 73 | public static final int UUID_BOX = 0x75756964; 74 | 75 | public static final int UUID_INFO_BOX = 0x75696e66; 76 | 77 | /** JP2 Header boxes */ 78 | public static final int IMAGE_HEADER_BOX = 0x69686472; 79 | 80 | public static final int BITS_PER_COMPONENT_BOX = 0x62706363; 81 | 82 | public static final int COLOUR_SPECIFICATION_BOX = 0x636f6c72; 83 | 84 | public static final int PALETTE_BOX = 0x70636c72; 85 | 86 | public static final int COMPONENT_MAPPING_BOX = 0x636d6170; 87 | 88 | public static final int CHANNEL_DEFINITION_BOX = 0x63646566; 89 | 90 | public static final int RESOLUTION_BOX = 0x72657320; 91 | 92 | public static final int CAPTURE_RESOLUTION_BOX = 0x72657363; 93 | 94 | public static final int DEFAULT_DISPLAY_RESOLUTION_BOX = 0x72657364; 95 | 96 | /** End of JP2 Header boxes */ 97 | 98 | /** UUID Info Boxes */ 99 | public static final int UUID_LIST_BOX = 0x75637374; 100 | 101 | public static final int URL_BOX = 0x75726c20; 102 | /** end of UUID Info boxes */ 103 | 104 | /** Image Header Box Fields */ 105 | public static final int IMB_VERS = 0x0100; 106 | 107 | public static final int IMB_C = 7; 108 | 109 | public static final int IMB_UnkC = 1; 110 | 111 | public static final int IMB_IPR = 0; 112 | /** end of Image Header Box Fields*/ 113 | 114 | /** Colour Specification Box Fields */ 115 | public static final int CSB_METH = 1; 116 | 117 | public static final int CSB_PREC = 0; 118 | 119 | public static final int CSB_APPROX = 0; 120 | 121 | public static final int CSB_ENUM_SRGB = 16; 122 | 123 | public static final int CSB_ENUM_GREY = 17; 124 | /** en of Colour Specification Box Fields */ 125 | 126 | /** File Type Fields */ 127 | public static final int FT_BR = 0x6a703220; 128 | 129 | 130 | 131 | } 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /src/jj2000/j2k/image/CompTransfSpec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: CompTransfSpec.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: CompTransfSpec 7 | * 8 | * Description: Component Transformation specification 9 | * 10 | * 11 | * 12 | * COPYRIGHT: 13 | * 14 | * This software module was originally developed by Raphal Grosbois and 15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 18 | * Centre France S.A) in the course of development of the JPEG2000 19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 20 | * software module is an implementation of a part of the JPEG 2000 21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 24 | * 2000 Standard (Users) any of their rights under the copyright, not 25 | * including other intellectual property rights, for this software module 26 | * with respect to the usage by ISO/IEC and Users of this software module 27 | * or modifications thereof for use in hardware or software products 28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 29 | * this software module in hardware or software products are advised that 30 | * their use may infringe existing patents. The original developers of 31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 32 | * for use of this software module or modifications thereof. No license 33 | * or right to this software module is granted for non JPEG 2000 Standard 34 | * conforming products. JJ2000 Partners have full right to use this 35 | * software module for his/her own purpose, assign or donate this 36 | * software module to any third party and to inhibit third parties from 37 | * using this software module for non JPEG 2000 Standard conforming 38 | * products. This copyright notice must be included in all copies or 39 | * derivative works of this software module. 40 | * 41 | * Copyright (c) 1999/2000 JJ2000 Partners. 42 | * */ 43 | package jj2000.j2k.image; 44 | 45 | import jj2000.j2k.image.invcomptransf.*; 46 | import jj2000.j2k.*; 47 | 48 | /** 49 | * This class extends the ModuleSpec class in order to hold tile 50 | * specifications for multiple component transformation 51 | * 52 | * @see ModuleSpec 53 | * */ 54 | public class CompTransfSpec extends ModuleSpec { 55 | 56 | /** 57 | * Constructs an empty 'CompTransfSpec' with the specified number of tiles 58 | * and components. This constructor is called by the decoder. Note: The 59 | * number of component is here for symmetry purpose. It is useless since 60 | * only tile specifications are meaningful. 61 | * 62 | * @param nt Number of tiles 63 | * 64 | * @param nc Number of components 65 | * 66 | * @param type the type of the specification module i.e. tile specific, 67 | * component specific or both. 68 | * */ 69 | public CompTransfSpec(int nt, int nc, byte type){ 70 | super(nt, nc, type); 71 | } 72 | 73 | 74 | /** 75 | * Check if component transformation is used in any of the tiles. This 76 | * method must not be used by the encoder. 77 | * 78 | * @return True if a component transformation is used in at least on 79 | * tile. 80 | * */ 81 | public boolean isCompTransfUsed(){ 82 | if( ((Integer)def).intValue() != InvCompTransf.NONE ){ 83 | return true; 84 | } 85 | 86 | if(tileDef!=null){ 87 | for(int t=nTiles-1; t>=0; t--){ 88 | if(tileDef[t]!=null && 89 | ( ((Integer)tileDef[t]).intValue() != InvCompTransf.NONE) ){ 90 | return true; 91 | } 92 | } 93 | } 94 | return false; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/jj2000/j2k/image/Coord.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: Coord.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: Coord 7 | * 8 | * Description: Class for storage of 2-D coordinates 9 | * 10 | * 11 | * 12 | * COPYRIGHT: 13 | * 14 | * This software module was originally developed by Raphal Grosbois and 15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 18 | * Centre France S.A) in the course of development of the JPEG2000 19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 20 | * software module is an implementation of a part of the JPEG 2000 21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 24 | * 2000 Standard (Users) any of their rights under the copyright, not 25 | * including other intellectual property rights, for this software module 26 | * with respect to the usage by ISO/IEC and Users of this software module 27 | * or modifications thereof for use in hardware or software products 28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 29 | * this software module in hardware or software products are advised that 30 | * their use may infringe existing patents. The original developers of 31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 32 | * for use of this software module or modifications thereof. No license 33 | * or right to this software module is granted for non JPEG 2000 Standard 34 | * conforming products. JJ2000 Partners have full right to use this 35 | * software module for his/her own purpose, assign or donate this 36 | * software module to any third party and to inhibit third parties from 37 | * using this software module for non JPEG 2000 Standard conforming 38 | * products. This copyright notice must be included in all copies or 39 | * derivative works of this software module. 40 | * 41 | * Copyright (c) 1999/2000 JJ2000 Partners. 42 | * */ 43 | package jj2000.j2k.image; 44 | 45 | /** 46 | * This class represents 2-D coordinates. 47 | * */ 48 | public class Coord { 49 | /** The horizontal coordinate */ 50 | public int x; 51 | 52 | /** The vertical coordinate */ 53 | public int y; 54 | 55 | /** 56 | * Creates a new coordinate object given with the (0,0) coordinates 57 | * */ 58 | public Coord() { } 59 | 60 | /** 61 | * Creates a new coordinate object given the two coordinates. 62 | * 63 | * @param x The horizontal coordinate. 64 | * 65 | * @param y The vertical coordinate. 66 | * */ 67 | public Coord(int x, int y) { 68 | this.x = x; 69 | this.y = y; 70 | } 71 | 72 | /** 73 | * Creates a new coordinate object given another Coord object i.e. copy 74 | * constructor 75 | * 76 | * @param c The Coord object to be copied. 77 | * */ 78 | public Coord(Coord c) { 79 | this.x = c.x; 80 | this.y = c.y; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/jj2000/j2k/io/EndianType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS Identifier: 3 | * 4 | * $Id: EndianType.java 166 2012-01-11 23:48:05Z mroland $ 5 | * 6 | * Interface: EndianType 7 | * 8 | * Description: Defines the two types of endianess (i.e. byte 9 | * ordering). 10 | * 11 | * 12 | * 13 | * COPYRIGHT: 14 | * 15 | * This software module was originally developed by Raphal Grosbois and 16 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 17 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 18 | * Bouchard, Flix 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 | * 45 | * 46 | */ 47 | 48 | package jj2000.j2k.io; 49 | 50 | /** 51 | * This interface defines constants for the two types of byte 52 | * ordering: little- and big-endian. 53 | * 54 | *Little-endian is least significant byte first. 55 | * 56 | *
Big-endian is most significant byte first. 57 | * 58 | *
This interface defines the constants only. In order to use the 59 | * constants in any other class you can either use the fully qualified 60 | * name (e.g., EndianType.LITTLE_ENDIAN) or declare this 61 | * interface in the implements clause of the class and then access the 62 | * identifier directly. 63 | * 64 | */ 65 | public interface EndianType { 66 | 67 | /** Identifier for big-endian byte ordering (i.e. most significant 68 | * byte first) */ 69 | public static final int BIG_ENDIAN = 0; 70 | 71 | /** Identifier for little-endian byte ordering (i.e. least 72 | * significant byte first) */ 73 | public static final int LITTLE_ENDIAN = 1; 74 | } 75 | -------------------------------------------------------------------------------- /src/jj2000/j2k/quantization/QuantizationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: QuantizationType.java 166 2012-01-11 23:48:05Z mroland $ 5 | * 6 | * Class: QuantizationType 7 | * 8 | * Description: This interface defines the possible 9 | * quantization types. 10 | * 11 | * 12 | * 13 | * COPYRIGHT: 14 | * 15 | * This software module was originally developed by Raphal Grosbois and 16 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 17 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 18 | * Bouchard, Flix 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 | * 45 | * 46 | */ 47 | 48 | 49 | package jj2000.j2k.quantization; 50 | 51 | /** 52 | * This interface defines the IDs of the possible quantization types. JPEG 53 | * 2000 part I support only the scalar quantization with dead zone. However 54 | * other quantization type may be defined in JPEG 2000 extensions (for 55 | * instance Trellis Coded Quantization). 56 | * 57 | *
This interface defines the constants only. In order to use the 58 | * constants in any other class you can either use the fully qualified 59 | * name (e.g., QuantizationType.Q_TYPE_SCALAR_DZ) or declare 60 | * this interface in the implements clause of the class and then 61 | * access the identifier directly. 62 | * */ 63 | public interface QuantizationType { 64 | 65 | /** The ID of the scalar deadzone dequantizer */ 66 | public final static int Q_TYPE_SCALAR_DZ = 0; 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/jj2000/j2k/quantization/dequantizer/DequantizerParams.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: DequantizerParams.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: DequantizerParams 7 | * 8 | * Description: Generic class to hold dequantizer 9 | * parameters. 10 | * 11 | * 12 | * 13 | * COPYRIGHT: 14 | * 15 | * This software module was originally developed by Raphal Grosbois and 16 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 17 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 18 | * Bouchard, Flix 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 | 45 | 46 | package jj2000.j2k.quantization.dequantizer; 47 | 48 | /** 49 | * This is the generic ineterface for dequantization parameters. Generally, 50 | * for each type of dequantizer, there should be a corresponding class to 51 | * store its parameters. The parameters are those that come from the bit 52 | * stream header, that concern dequantization. 53 | * */ 54 | public abstract class DequantizerParams { 55 | 56 | /** 57 | * Returns the type of the dequantizer for which the parameters are. The 58 | * types are defined in the Dequantizer class. 59 | * 60 | * @return The type of the dequantizer for which the parameters 61 | * are. 62 | * 63 | * @see Dequantizer 64 | * */ 65 | public abstract int getDequantizerType(); 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/jj2000/j2k/quantization/dequantizer/StdDequantizerParams.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: StdDequantizerParams.java 169 2012-01-15 18:33:24Z mroland $ 5 | * 6 | * Class: StdDequantizerParams 7 | * 8 | * Description: Parameters for the scalar deadzone dequantizers 9 | * 10 | * 11 | * 12 | * COPYRIGHT: 13 | * 14 | * This software module was originally developed by Raphal Grosbois and 15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research 18 | * Centre France S.A) in the course of development of the JPEG2000 19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This 20 | * software module is an implementation of a part of the JPEG 2000 21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio 22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG 24 | * 2000 Standard (Users) any of their rights under the copyright, not 25 | * including other intellectual property rights, for this software module 26 | * with respect to the usage by ISO/IEC and Users of this software module 27 | * or modifications thereof for use in hardware or software products 28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use 29 | * this software module in hardware or software products are advised that 30 | * their use may infringe existing patents. The original developers of 31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability 32 | * for use of this software module or modifications thereof. No license 33 | * or right to this software module is granted for non JPEG 2000 Standard 34 | * conforming products. JJ2000 Partners have full right to use this 35 | * software module for his/her own purpose, assign or donate this 36 | * software module to any third party and to inhibit third parties from 37 | * using this software module for non JPEG 2000 Standard conforming 38 | * products. This copyright notice must be included in all copies or 39 | * derivative works of this software module. 40 | * 41 | * Copyright (c) 1999/2000 JJ2000 Partners. 42 | */ 43 | package jj2000.j2k.quantization.dequantizer; 44 | 45 | import jj2000.j2k.wavelet.*; 46 | import jj2000.j2k.quantization.*; 47 | 48 | /** 49 | * This class holds the parameters for the scalar deadzone dequantizer 50 | * (StdDequantizer class) for the current tile. Its constructor decodes the 51 | * parameters from the main header and tile headers. 52 | * 53 | * @see StdDequantizer 54 | * */ 55 | public class StdDequantizerParams extends DequantizerParams { 56 | 57 | /** 58 | * The quantization step "exponent" value, for each resolution level and 59 | * subband, as it appears in the codestream. The first index is the 60 | * resolution level, and the second the subband index (within the 61 | * resolution level), as specified in the Subband class. When in derived 62 | * quantization mode only the first resolution level (level 0) appears. 63 | * 64 | *
For non-reversible systems this value corresponds to ceil(log2(D')), 65 | * where D' is the quantization step size normalized to data of a dynamic 66 | * range of 1. The true quantization step size is (2^R)*D', where R is 67 | * ceil(log2(dr)), where 'dr' is the dynamic range of the subband samples, 68 | * in the corresponding subband. 69 | * 70 | *
For reversible systems the exponent value in 'exp' is used to 71 | * determine the number of magnitude bits in the quantized 72 | * coefficients. It is, in fact, the dynamic range of the subband data. 73 | * 74 | *
In general the index of the first subband in a resolution level is 75 | * not 0. The exponents appear, within each resolution level, at their 76 | * subband index, and not in the subband order starting from 0. For 77 | * instance, resolution level 3, the first subband has the index 16, then 78 | * the exponent of the subband is exp[3][16], not exp[3][0]. 79 | * 80 | * @see Subband 81 | * */ 82 | public int exp[][]; 83 | 84 | /** 85 | * The quantization step for non-reversible systems, normalized to a 86 | * dynamic range of 1, for each resolution level and subband, as derived 87 | * from the exponent-mantissa representation in the codestream. The first 88 | * index is the resolution level, and the second the subband index (within 89 | * the resolution level), as specified in the Subband class. When in 90 | * derived quantization mode only the first resolution level (level 0) 91 | * appears. 92 | * 93 | *
The true step size D is obtained as follows: D=(2^R)*D', where 94 | * 'R=ceil(log2(dr))' and 'dr' is the dynamic range of the subband 95 | * samples, in the corresponding subband. 96 | * 97 | *
This value is 'null' for reversible systems (i.e. there is no true 98 | * quantization, 'D' is always 1). 99 | * 100 | *
In general the index of the first subband in a resolution level is
101 | * not 0. The steps appear, within each resolution level, at their subband
102 | * index, and not in the subband order starting from 0. For instance, if
103 | * resolution level 3, the first subband has the index 16, then the step
104 | * of the subband is nStep[3][16], not nStep[3][0].
105 | *
106 | * @see Subband
107 | * */
108 | public float nStep[][];
109 |
110 | /**
111 | * Returns the type of the dequantizer for which the parameters are. The
112 | * types are defined in the Dequantizer class.
113 | *
114 | * @return The type of the dequantizer for which the parameters
115 | * are. Always Q_TYPE_SCALAR_DZ.
116 | *
117 | * @see Dequantizer
118 | * */
119 | public int getDequantizerType() {
120 | return QuantizationType.Q_TYPE_SCALAR_DZ;
121 | }
122 |
123 | }
124 |
--------------------------------------------------------------------------------
/src/jj2000/j2k/roi/MaxShiftSpec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * CVS identifier:
3 | *
4 | * $Id: MaxShiftSpec.java 169 2012-01-15 18:33:24Z mroland $
5 | *
6 | * Class: MaxShiftSpec
7 | *
8 | * Description: Generic class for storing module specs
9 | *
10 | *
11 | *
12 | * COPYRIGHT:
13 | *
14 | * This software module was originally developed by Raphal Grosbois and
15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel
16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David
17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research
18 | * Centre France S.A) in the course of development of the JPEG2000
19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This
20 | * software module is an implementation of a part of the JPEG 2000
21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio
22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000
23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG
24 | * 2000 Standard (Users) any of their rights under the copyright, not
25 | * including other intellectual property rights, for this software module
26 | * with respect to the usage by ISO/IEC and Users of this software module
27 | * or modifications thereof for use in hardware or software products
28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use
29 | * this software module in hardware or software products are advised that
30 | * their use may infringe existing patents. The original developers of
31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability
32 | * for use of this software module or modifications thereof. No license
33 | * or right to this software module is granted for non JPEG 2000 Standard
34 | * conforming products. JJ2000 Partners have full right to use this
35 | * software module for his/her own purpose, assign or donate this
36 | * software module to any third party and to inhibit third parties from
37 | * using this software module for non JPEG 2000 Standard conforming
38 | * products. This copyright notice must be included in all copies or
39 | * derivative works of this software module.
40 | *
41 | * Copyright (c) 1999/2000 JJ2000 Partners.
42 | */
43 | package jj2000.j2k.roi;
44 |
45 | import jj2000.j2k.*;
46 |
47 | /**
48 | * This class contains the maxshift scaling value for each tile-component.
49 | * The scaling values used are calculated in the ROIScaler class
50 | * */
51 |
52 | public class MaxShiftSpec extends ModuleSpec{
53 |
54 | /**
55 | * Constructs a 'ModuleSpec' object, initializing all the components and
56 | * tiles to the 'SPEC_DEF' spec type, for the specified number of
57 | * components and tiles.
58 | *
59 | * @param nt The number of tiles
60 | *
61 | * @param nc The number of components
62 | *
63 | * @param type the type of the specification module i.e. tile specific,
64 | * component specific or both.
65 | * */
66 | public MaxShiftSpec(int nt, int nc, byte type) {
67 | super(nt, nc, type);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/jj2000/j2k/util/ArrayUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * CVS identifier:
3 | *
4 | * $Id: ArrayUtil.java 166 2012-01-11 23:48:05Z mroland $
5 | *
6 | * Class: ArrayUtil
7 | *
8 | * Description: Utillities for arrays.
9 | *
10 | *
11 | *
12 | * COPYRIGHT:
13 | *
14 | * This software module was originally developed by Raphal Grosbois and
15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel
16 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David
17 | * Bouchard, Flix Henry, Gerard Mozelle and Patrice Onno (Canon Research
18 | * Centre France S.A) in the course of development of the JPEG2000
19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This
20 | * software module is an implementation of a part of the JPEG 2000
21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio
22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000
23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG
24 | * 2000 Standard (Users) any of their rights under the copyright, not
25 | * including other intellectual property rights, for this software module
26 | * with respect to the usage by ISO/IEC and Users of this software module
27 | * or modifications thereof for use in hardware or software products
28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use
29 | * this software module in hardware or software products are advised that
30 | * their use may infringe existing patents. The original developers of
31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability
32 | * for use of this software module or modifications thereof. No license
33 | * or right to this software module is granted for non JPEG 2000 Standard
34 | * conforming products. JJ2000 Partners have full right to use this
35 | * software module for his/her own purpose, assign or donate this
36 | * software module to any third party and to inhibit third parties from
37 | * using this software module for non JPEG 2000 Standard conforming
38 | * products. This copyright notice must be included in all copies or
39 | * derivative works of this software module.
40 | *
41 | * Copyright (c) 1999/2000 JJ2000 Partners.
42 | *
43 | *
44 | *
45 | */
46 |
47 |
48 | package jj2000.j2k.util;
49 |
50 | /**
51 | * This class contains a colleaction of utility static methods for arrays.
52 | * */
53 | public class ArrayUtil {
54 |
55 | /** The maximum array size to do element by element copying, larger
56 | * arrays are copyied in a n optimized way. */
57 | public static final int MAX_EL_COPYING = 8;
58 |
59 | /** The number of elements to copy initially in an optimized array copy */
60 | public static final int INIT_EL_COPYING = 4;
61 |
62 | /**
63 | * Reinitializes an int array to the given value in an optimized way. If
64 | * the length of the array is less than MAX_EL_COPYING, then the array
65 | * is set element by element in the normal way, otherwise the first
66 | * INIT_EL_COPYING elements are set element by element and then
67 | * System.arraycopy is used to set the other parts of the array.
68 | *
69 | * @param arr The array to set.
70 | *
71 | * @param val The value to set the array to.
72 | *
73 | *
74 | * */
75 | public static void intArraySet(int arr[], int val) {
76 | int i,len,len2;
77 |
78 | len = arr.length;
79 | // Set array to 'val' in an optimized way
80 | if (len < MAX_EL_COPYING) {
81 | // Not worth doing optimized way
82 | for (i=len-1; i>=0; i--) { // Set elements
83 | arr[i] = val;
84 | }
85 | }
86 | else { // Do in optimized way
87 | len2 = len>>1;
88 | for (i=0; i
The definition of the methods in this interface allows for different 56 | * types of implementation, reversibility and levels of decompositions for 57 | * each component and each tile. An implementation of this interface does not 58 | * need to support all this flexibility (e.g., it may provide the same 59 | * implementation type and decomposition levels for all tiles and 60 | * components).
61 | * */ 62 | public interface WaveletTransform extends ImgData { 63 | 64 | /** 65 | * ID for line based implementations of wavelet transforms. 66 | * */ 67 | public final static int WT_IMPL_LINE = 0; 68 | 69 | /** 70 | * ID for full-page based implementations of wavelet transforms. Full-page 71 | * based implementations should be avoided since they require large 72 | * amounts of memory. 73 | * */ 74 | public final static int WT_IMPL_FULL = 2; 75 | 76 | 77 | /** 78 | * Returns the reversibility of the wavelet transform for the specified 79 | * component and tile. A wavelet transform is reversible when it is 80 | * suitable for lossless and lossy-to-lossless compression. 81 | * 82 | * @param t The index of the tile. 83 | * 84 | * @param c The index of the component. 85 | * 86 | * @return true is the wavelet transform is reversible, false if not. 87 | * */ 88 | public boolean isReversible(int t,int c); 89 | 90 | /** 91 | * Returns the implementation type of this wavelet transform (WT_IMPL_LINE 92 | * or WT_IMPL_FRAME) for the specified component, in the current tile. 93 | * 94 | * @param c The index of the component. 95 | * 96 | * @return WT_IMPL_LINE or WT_IMPL_FULL for line, block or full-page based 97 | * transforms. 98 | * */ 99 | public int getImplementationType(int c); 100 | } 101 | -------------------------------------------------------------------------------- /src/jj2000/j2k/wavelet/synthesis/InvWT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: 5 | * 6 | * Class: InvWT 7 | * 8 | * Description: The interface for implementations of a inverse 9 | * wavelet transform. 10 | * 11 | * 12 | * 13 | * COPYRIGHT: 14 | * 15 | * This software module was originally developed by Raphal Grosbois and 16 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel 17 | * Askelf (Ericsson Radio Systems AB); and Bertrand Berthelot, David 18 | * Bouchard, Flix 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 | package jj2000.j2k.wavelet.synthesis; 45 | 46 | import jj2000.j2k.wavelet.*; 47 | 48 | /** 49 | * This interface extends the WaveletTransform with the specifics of inverse 50 | * wavelet transforms. Classes that implement inverse wavelet transfoms should 51 | * implement this interface. 52 | * 53 | *This class does not define the methods to transfer data, just the 54 | * specifics to inverse wavelet transform. Different data transfer methods are 55 | * envisageable for different transforms.
56 | * */ 57 | public interface InvWT extends WaveletTransform { 58 | 59 | /** 60 | * Sets the image reconstruction resolution level. A value of 0 means 61 | * reconstruction of an image with the lowest resolution (dimension) 62 | * available. 63 | * 64 | *Note: Image resolution level indexes may differ from tile-component 65 | * resolution index. They are indeed indexed starting from the lowest 66 | * number of decomposition levels of each component of each tile.
67 | * 68 | *Example: For an image (1 tile) with 2 components (component 0 having 69 | * 2 decomposition levels and component 1 having 3 decomposition levels), 70 | * the first (tile-) component has 3 resolution levels and the second one 71 | * has 4 resolution levels, whereas the image has only 3 resolution levels 72 | * available.
73 | * 74 | * @param rl The image resolution level. 75 | * 76 | * @return The vertical coordinate of the image origin in the canvas 77 | * system, on the reference grid. 78 | * */ 79 | public void setImgResLevel(int rl); 80 | } 81 | -------------------------------------------------------------------------------- /src/jj2000/j2k/wavelet/synthesis/InvWTData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CVS identifier: 3 | * 4 | * $Id: InvWTData.java 166 2012-01-11 23:48:05Z mroland $ 5 | * 6 | * Class: InvWTData 7 | * 8 | * Description:The image can be reconstructed at different resolution levels. This is 54 | * controlled by the setResLevel() method. All the image, tile and component 55 | * dimensions are relative the the resolution level being used. The number of 56 | * resolution levels indicates the number of wavelet recompositions that will 57 | * be used, if it is equal as the number of decomposition levels then the full 58 | * resolution image is reconstructed.
59 | * 60 | *It is assumed in this class that all tiles and components the same 61 | * reconstruction resolution level. If that where not the case the 62 | * implementing class should have additional data structures to store those 63 | * values for each tile. However, the 'recResLvl' member variable always 64 | * contain the values applicable to the current tile, since many methods 65 | * implemented here rely on them.
66 | * */ 67 | public abstract class InverseWT extends InvWTAdapter implements BlkImgDataSrc { 68 | 69 | /** 70 | * Initializes this object with the given source of wavelet 71 | * coefficients. It initializes the resolution level for full resolutioin 72 | * reconstruction (i.e. the maximum resolution available from the 'src' 73 | * source). 74 | * 75 | *It is assumed here that all tiles and components have the same 76 | * reconstruction resolution level. If that was not the case it should be 77 | * the value for the current tile of the source.
78 | * 79 | * @param src from where the wavelet coefficinets should be obtained. 80 | * 81 | * @param decSpec The decoder specifications 82 | * */ 83 | public InverseWT(MultiResImgData src,DecoderSpecs decSpec){ 84 | super(src,decSpec); 85 | } 86 | 87 | /** 88 | * Creates an InverseWT object that works on the data type of the source, 89 | * with the special additional parameters from the parameter 90 | * list. Currently the parameter list is ignored since no special 91 | * parameters can be specified for the inverse wavelet transform yet. 92 | * 93 | * @param src The source of data for the inverse wavelet 94 | * transform. 95 | * 96 | * @param pl The parameter list containing parameters applicable to the 97 | * inverse wavelet transform (other parameters can also be present). 98 | * */ 99 | public static InverseWT createInstance(CBlkWTDataSrcDec src, 100 | DecoderSpecs decSpec) { 101 | 102 | // full page wavelet transform 103 | return new InvWTFull(src,decSpec); 104 | } 105 | } 106 | --------------------------------------------------------------------------------