├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-ldpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── values
│ └── strings.xml
└── layout
│ ├── reader.xml
│ └── main.xml
├── README.md
├── project.properties
├── proguard-project.txt
├── src
└── jj2000
│ ├── icc
│ ├── ICCProfileException.java
│ ├── lut
│ │ ├── MonochromeTransformException.java
│ │ ├── MatrixBasedTransformException.java
│ │ ├── LookUpTableFPGamma.java
│ │ ├── LookUpTable.java
│ │ ├── LookUpTable32Gamma.java
│ │ ├── LookUpTableFP.java
│ │ ├── LookUpTableFPInterp.java
│ │ ├── LookUpTable32Interp.java
│ │ ├── LookUpTable32.java
│ │ ├── LookUpTable32LinearSRGBtoSRGB.java
│ │ └── MonochromeTransformTosRGB.java
│ ├── ICCProfileInvalidException.java
│ ├── MonochromeInputRestrictedProfile.java
│ ├── tags
│ │ ├── ICCXYZTypeReverse.java
│ │ ├── ICCTextType.java
│ │ ├── ICCTextDescriptionType.java
│ │ ├── ICCXYZType.java
│ │ ├── ICCCurveType.java
│ │ ├── ICCCurveTypeReverse.java
│ │ └── ICCTagTable.java
│ ├── types
│ │ ├── ICCProfileVersion.java
│ │ ├── XYZNumber.java
│ │ └── ICCDateTime.java
│ ├── ICCMonochromeInputProfile.java
│ ├── ICCMatrixBasedInputProfile.java
│ ├── MatrixBasedRestrictedProfile.java
│ └── RestrictedICCProfile.java
│ ├── colorspace
│ ├── ColorSpaceException.java
│ └── boxes
│ │ ├── ImageHeaderBox.java
│ │ ├── ComponentMappingBox.java
│ │ ├── ColorSpecificationBox.java
│ │ ├── ChannelDefinitionBox.java
│ │ ├── PaletteBox.java
│ │ └── JP2Box.java
│ ├── JJ2000Frontend.java
│ └── j2k
│ ├── wavelet
│ ├── FilterTypes.java
│ ├── synthesis
│ │ ├── InvWTData.java
│ │ ├── InvWT.java
│ │ └── InverseWT.java
│ └── WaveletTransform.java
│ ├── util
│ ├── StringFormatException.java
│ └── ArrayUtil.java
│ ├── roi
│ └── MaxShiftSpec.java
│ ├── quantization
│ ├── dequantizer
│ │ ├── DequantizerParams.java
│ │ └── StdDequantizerParams.java
│ └── QuantizationType.java
│ ├── codestream
│ ├── CBlkCoordInfo.java
│ ├── CorruptedCodestreamException.java
│ ├── CoordInfo.java
│ ├── ProgressionType.java
│ ├── PrecInfo.java
│ └── reader
│ │ └── CBlkInfo.java
│ ├── NoNextElementException.java
│ ├── image
│ ├── Coord.java
│ └── CompTransfSpec.java
│ ├── io
│ └── EndianType.java
│ ├── NotImplementedError.java
│ ├── entropy
│ ├── CodedCBlk.java
│ ├── decoder
│ │ ├── DecLyrdCBlk.java
│ │ └── CodedCBlkDataSrcDec.java
│ └── StdEntropyCoderOptions.java
│ ├── JJ2KInfo.java
│ └── fileformat
│ └── FileFormatBoxes.java
└── AndroidManifest.xml
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soft-studio/NFC_DriversLicenseReader/HEAD/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soft-studio/NFC_DriversLicenseReader/HEAD/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soft-studio/NFC_DriversLicenseReader/HEAD/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soft-studio/NFC_DriversLicenseReader/HEAD/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | NFC_DriversLicenseReader
2 | ========================
3 |
4 | AndroidNFC端末用の、運転免許証読み込みアプリです。
5 | アプリは、
6 | https://play.google.com/store/apps/details?id=jp.softstudio.DriversLicenseReader
7 | にて公開中。
8 |
9 | This software is released under the MIT License,
10 |
11 | AndroidStudio対応版は、
12 | https://github.com/soft-studio/NFC_DriversLicenseReader_AS
13 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-10
15 |
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/src/jj2000/icc/ICCProfileException.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCProfileException.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 | package jj2000.icc;
9 |
10 | /**
11 | * This exception is thrown when the content of a profile
12 | * is incorrect.
13 | *
14 | * @see jj2000.j2k.icc.ICCProfile
15 | * @version 1.0
16 | * @author Bruce A. Kern
17 | */
18 | public class ICCProfileException extends Exception {
19 |
20 | /**
21 | * Contruct with message
22 | * @param msg returned by getMessage()
23 | */
24 | public ICCProfileException (String msg) {
25 | super (msg);
26 | }
27 |
28 |
29 | /**
30 | * Empty constructor
31 | */
32 | public ICCProfileException () { }
33 | }
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello World, DriversLicenseReaderActivity!
5 | 運転免許証リーダー
6 |
7 | 暗証番号1
8 | 暗証番号2(本籍、写真)
9 | 読み取り開始
10 |
11 | 免許証をタッチしてください。
12 |
13 | 暗証番号が違います
14 | 正しく読み込めませんでした。
15 | 免許証がロックされてます。\n最寄りの警察署までご相談ください。
16 |
17 | 読み込み中です。運転免許証を離さないでください。
18 |
19 | 4桁
20 | 暗証番号2はオプションです。チェックボックスにチェックを入れることで有効となります。\n暗証番号を3回間違えると、以降読み出せなくなります。\nご注意ください。\n読み出せなくなった場合には、最寄りの警察署までご相談ください。\n暗証番号を設定されなかった場合には、空白のままで読み取り開始してください。(環境がないためテストしておりません。ご注意ください)
21 | 顔写真のデコードにはjj2000(https://code.google.com/p/jj2000/)を使用しております。
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/jj2000/icc/lut/MonochromeTransformException.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: MonochromeTransformException.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.lut;
10 |
11 | /**
12 | * Exception thrown by MonochromeTransformTosRGB.
13 | *
14 | * @see jj2000.j2k.icc.lut.MonochromeTransformTosRGB
15 | * @version 1.0
16 | * @author Bruce A. Kern
17 | */
18 |
19 | public class MonochromeTransformException extends Exception {
20 |
21 | /**
22 | * Contruct with message
23 | * @param msg returned by getMessage()
24 | */
25 | MonochromeTransformException (String msg) {
26 | super (msg); }
27 |
28 | /**
29 | * Empty constructor
30 | */
31 | MonochromeTransformException () {
32 | }
33 |
34 | /* end class MonochromeTransformException */ }
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/jj2000/icc/lut/MatrixBasedTransformException.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: MatrixBasedTransformException.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.lut;
10 |
11 | /**
12 | * Thrown by MatrixBasedTransformTosRGB
13 | *
14 | * @see jj2000.j2k.icc.lut.MatrixBasedTransformTosRGB
15 | * @version 1.0
16 | * @author Bruce A. Kern
17 | */
18 |
19 | public class MatrixBasedTransformException extends Exception {
20 |
21 | /**
22 | * Contruct with message
23 | * @param msg returned by getMessage()
24 | */
25 | MatrixBasedTransformException (String msg) {
26 | super (msg); }
27 |
28 |
29 | /**
30 | * Empty constructor
31 | */
32 | MatrixBasedTransformException () {
33 | }
34 |
35 | /* end class MatrixBasedTransformException */ }
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/jj2000/colorspace/ColorSpaceException.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ColorSpaceException.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.colorspace;
10 |
11 | /**
12 | * This exception is thrown when the content of an
13 | * image contains an incorrect colorspace box
14 | *
15 | * @see jj2000.j2k.colorspace.ColorSpaceMapper
16 | * @version 1.0
17 | * @author Bruce A. Kern
18 | */
19 |
20 | public class ColorSpaceException extends Exception {
21 |
22 | /**
23 | * Contruct with message
24 | * @param msg returned by getMessage()
25 | */
26 | public ColorSpaceException (String msg) {
27 | super (msg); }
28 |
29 |
30 | /**
31 | * Empty constructor
32 | */
33 | public ColorSpaceException () {
34 | }
35 |
36 | /* end class ColorSpaceException */ }
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/jj2000/icc/ICCProfileInvalidException.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCProfileInvalidException.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc;
10 |
11 | /**
12 | * This exception is thrown when the content of an an icc profile
13 | * is in someway incorrect.
14 | *
15 | * @see jj2000.j2k.icc.ICCProfile
16 | * @version 1.0
17 | * @author Bruce A. Kern
18 | */
19 |
20 | public class ICCProfileInvalidException extends ICCProfileException {
21 |
22 | /**
23 | * Contruct with message
24 | * @param msg returned by getMessage()
25 | */
26 | ICCProfileInvalidException (String msg) {
27 | super (msg); }
28 |
29 |
30 | /**
31 | * Empty constructor
32 | */
33 | ICCProfileInvalidException () {
34 | super ("icc profile is invalid"); }
35 |
36 | /* end class ICCProfileInvalidException */ }
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/jj2000/icc/lut/LookUpTableFPGamma.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: LookUpTableFPGamma.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.lut;
10 |
11 | import jj2000.icc.tags.ICCCurveType;
12 |
13 | /**
14 | * Class Description
15 | *
16 | * @version 1.0
17 | * @author Bruce A. Kern
18 | */
19 |
20 | public class LookUpTableFPGamma extends LookUpTableFP {
21 |
22 | double dfE = -1;
23 | private static final String eol = System.getProperty("line.separator");
24 |
25 | public LookUpTableFPGamma (
26 | ICCCurveType curve, // Pointer to the curve data
27 | int dwNumInput // Number of input values in created LUT
28 | ) {
29 | super (curve, dwNumInput);
30 |
31 | // Gamma exponent for inverse transformation
32 | dfE = ICCCurveType.CurveGammaToDouble(curve.entry(0));
33 | for (int i = 0; i < dwNumInput; i++)
34 | lut[i] = (float) Math.pow((double)i / (dwNumInput - 1), dfE); }
35 |
36 |
37 | /* end class LookUpTableFPGamma */ }
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/res/layout/reader.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
17 |
23 |
24 |
28 |
29 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/jj2000/icc/lut/LookUpTable.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: LookUpTable.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.lut;
10 |
11 | import jj2000.icc.tags.ICCCurveType;
12 |
13 |
14 | /**
15 | * Toplevel class for a lut. All lookup tables must
16 | * extend this class.
17 | *
18 | * @version 1.0
19 | * @author Bruce A. Kern
20 | */
21 | public abstract class LookUpTable {
22 |
23 | /** End of line string. */ protected static final String eol = System.getProperty ("line.separator");
24 | /** The curve data */ protected ICCCurveType curve = null;
25 | /** Number of values in created lut */ protected int dwNumInput = 0;
26 |
27 |
28 | /**
29 | * For subclass usage.
30 | * @param curve The curve data
31 | * @param dwNumInput Number of values in created lut
32 | */
33 | protected LookUpTable (
34 | ICCCurveType curve,
35 | int dwNumInput
36 | ) {
37 | this.curve = curve;
38 | this.dwNumInput = dwNumInput; }
39 |
40 | /* end class LookUpTable */ }
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/jj2000/icc/MonochromeInputRestrictedProfile.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: MonochromeInputRestrictedProfile.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc;
10 |
11 | import jj2000.icc.tags.ICCCurveType;
12 |
13 | /**
14 | * This class is a 1 component RestrictedICCProfile
15 | *
16 | * @version 1.0
17 | * @author Bruce A Kern
18 | */
19 | public class MonochromeInputRestrictedProfile extends RestrictedICCProfile {
20 |
21 | /**
22 | * Factory method which returns a 1 component RestrictedICCProfile
23 | * @param c Gray TRC curve
24 | * @return the RestrictedICCProfile
25 | */
26 | public static RestrictedICCProfile createInstance (ICCCurveType c) {
27 | return new MonochromeInputRestrictedProfile(c);}
28 |
29 | /**
30 | * Construct a 1 component RestrictedICCProfile
31 | * @param c Gray TRC curve
32 | */
33 | private MonochromeInputRestrictedProfile (ICCCurveType c) {
34 | super (c); }
35 |
36 | /**
37 | * Get the type of RestrictedICCProfile for this object
38 | * @return kMonochromeInput
39 | */
40 | public int getType () {return kMonochromeInput;}
41 |
42 | /* end class MonochromeInputRestrictedProfile */ }
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/jj2000/icc/tags/ICCXYZTypeReverse.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCXYZTypeReverse.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.tags;
10 |
11 | import jj2000.icc.ICCProfile;
12 |
13 | /**
14 | * A tag containing a triplet.
15 | *
16 | * @see jj2000.j2k.icc.tags.ICCXYZType
17 | * @see jj2000.j2k.icc.types.XYZNumber
18 | * @version 1.0
19 | * @author Bruce A. Kern
20 | */
21 | public class ICCXYZTypeReverse extends ICCXYZType {
22 |
23 | /** x component */ public final long x;
24 | /** y component */ public final long y;
25 | /** z component */ public final long z;
26 |
27 | /**
28 | * Construct this tag from its constituant parts
29 | * @param signature tag id
30 | * @param data array of bytes
31 | * @param offset to data in the data array
32 | * @param length of data in the data array
33 | */
34 | protected ICCXYZTypeReverse (int signature, byte [] data, int offset, int length) {
35 | super (signature, data, offset, length);
36 | z=ICCProfile.getInt (data, offset+2*ICCProfile.int_size);
37 | y=ICCProfile.getInt (data, offset+3*ICCProfile.int_size);
38 | x=ICCProfile.getInt (data, offset+4*ICCProfile.int_size); }
39 |
40 |
41 | /* end class ICCXYZTypeReverse */ }
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/src/jj2000/icc/tags/ICCTextType.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCTextType.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.tags;
10 |
11 | import jj2000.icc.ICCProfile;
12 |
13 | /**
14 | * A text based ICC tag
15 | *
16 | * @version 1.0
17 | * @author Bruce A. Kern
18 | */
19 | public class ICCTextType extends ICCTag {
20 |
21 | /** Tag fields */ public final int type;
22 | /** Tag fields */ public final int reserved;
23 | /** Tag fields */ public final byte[] ascii;
24 |
25 | /**
26 | * Construct this tag from its constituant parts
27 | * @param signature tag id
28 | * @param data array of bytes
29 | * @param offset to data in the data array
30 | * @param length of data in the data array
31 | */
32 | protected ICCTextType (int signature, byte [] data, int offset, int length) {
33 | super (signature, data, offset, length);
34 | type = ICCProfile.getInt (data, offset);
35 | offset += ICCProfile.int_size;
36 | reserved = ICCProfile.getInt (data, offset);
37 | offset += ICCProfile.int_size;
38 | int size = 0;
39 | while (data[offset+size]!=0) ++size;
40 | ascii = new byte [size];
41 | System.arraycopy (data,offset,ascii,0,size); }
42 |
43 |
44 | /* end class ICCTextType */ }
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/jj2000/icc/lut/LookUpTable32Gamma.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: LookUpTable32Gamma.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.lut;
10 |
11 | import jj2000.icc.tags.ICCCurveType;
12 |
13 | /**
14 | * A Gamma based 32 bit lut.
15 | *
16 | * @see jj2000.j2k.icc.tags.ICCCurveType
17 | * @version 1.0
18 | * @author Bruce A. Kern
19 | */
20 |
21 | public class LookUpTable32Gamma extends LookUpTable32 {
22 |
23 |
24 | /* Construct the lut
25 | * @param curve data
26 | * @param dwNumInput size of lut
27 | * @param dwMaxOutput max value of lut
28 | */
29 | public LookUpTable32Gamma (
30 | ICCCurveType curve, // Pointer to the curve data
31 | int dwNumInput, // Number of input values in created LUT
32 | int dwMaxOutput // Maximum output value of the LUT
33 | ) {
34 | super (curve, dwNumInput, dwMaxOutput);
35 | double dfE = ICCCurveType.CurveGammaToDouble(curve.entry(0)); // Gamma exponent for inverse transformation
36 | for (int i = 0; i < dwNumInput; i++)
37 | lut[i] = (int) Math.floor(Math.pow((double)i / (dwNumInput - 1), dfE) * dwMaxOutput + 0.5); }
38 |
39 | /* end class LookUpTable32Gamma */ }
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/jj2000/icc/types/ICCProfileVersion.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCProfileVersion.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.types;
10 |
11 | import java.io.IOException;
12 | import java.io.RandomAccessFile;
13 | import jj2000.icc.ICCProfile;
14 |
15 | /**
16 | * This class describes the ICCProfile Version as contained in
17 | * the header of the ICC Profile.
18 | *
19 | * @see jj2000.j2k.icc.ICCProfile
20 | * @see jj2000.j2k.icc.types.ICCProfileHeader
21 | * @version 1.0
22 | * @author Bruce A. Kern
23 | */
24 | public class ICCProfileVersion {
25 | /** Field size */ public final static int size = 4 * ICCProfile.byte_size;
26 |
27 | /** Major revision number in binary coded decimal */ public byte uMajor;
28 | /** Minor revision in high nibble, bug fix revision
29 | in low nibble, both in binary coded decimal */ public byte uMinor;
30 |
31 | private byte reserved1;
32 | private byte reserved2;
33 |
34 | /** Construct from constituent parts. */
35 | public ICCProfileVersion (byte major, byte minor, byte res1, byte res2) {
36 | uMajor = major; uMinor = minor; reserved1 = res1; reserved2 = res2; }
37 |
38 | /** Construct from file content. */
39 | public void write (RandomAccessFile raf) throws IOException {
40 | raf.write(uMajor); raf.write(uMinor); raf.write(reserved1); raf.write(reserved2); }
41 |
42 | /* end class ICCProfileVersion */ }
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/src/jj2000/icc/types/XYZNumber.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: XYZNumber.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.types;
10 |
11 | import java.io.IOException;
12 | import java.io.RandomAccessFile;
13 | import jj2000.icc.ICCProfile;
14 |
15 | /**
16 | * A convientient representation for the contents of the
17 | * ICCXYZTypeTag class.
18 | *
19 | * @see jj2000.j2k.icc.tags.ICCXYZType
20 | * @version 1.0
21 | * @author Bruce A. Kern
22 | */
23 | public class XYZNumber
24 | {
25 | public final static int size = 3 * ICCProfile.int_size;
26 |
27 | /** x value */public int dwX; // X tristimulus value
28 | /** y value */public int dwY; // Y tristimulus value
29 | /** z value */public int dwZ; // Z tristimulus value
30 |
31 | /** Construct from constituent parts. */
32 | public XYZNumber (int x, int y, int z) {
33 | dwX = x; dwY = y; dwZ = z; }
34 |
35 | /** Normalization utility */
36 | public static int DoubleToXYZ ( double x ) {
37 | return (int) Math.floor(x * 65536.0 + 0.5); }
38 |
39 | /** Normalization utility */
40 | public static double XYZToDouble (int x) {
41 | return (double)x / 65536.0; }
42 |
43 | /** Write to a file */
44 | public void write (RandomAccessFile raf) throws IOException {
45 | raf.writeInt (dwX);
46 | raf.writeInt (dwY);
47 | raf.writeInt (dwZ); }
48 |
49 |
50 | /* end class XYZNumber */ }
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/jj2000/icc/tags/ICCTextDescriptionType.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCTextDescriptionType.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.tags;
10 |
11 | import jj2000.icc.ICCProfile;
12 |
13 | /**
14 | * A text based ICC tag
15 | *
16 | * @version 1.0
17 | * @author Bruce A. Kern
18 | */
19 | public class ICCTextDescriptionType extends ICCTag {
20 |
21 | /** Tag fields */ public final int type;
22 | /** Tag fields */ public final int reserved;
23 | /** Tag fields */ public final int size;
24 | /** Tag fields */ public final byte [] ascii;
25 |
26 | /**
27 | * Construct this tag from its constituant parts
28 | * @param signature tag id
29 | * @param data array of bytes
30 | * @param offset to data in the data array
31 | * @param length of data in the data array
32 | */
33 | protected ICCTextDescriptionType (int signature, byte [] data, int offset, int length) {
34 |
35 | super (signature, data, offset, length);
36 |
37 | type = ICCProfile.getInt (data, offset);
38 | offset += ICCProfile.int_size;
39 |
40 | reserved = ICCProfile.getInt (data, offset);
41 | offset += ICCProfile.int_size;
42 |
43 | size = ICCProfile.getInt (data, offset);
44 | offset += ICCProfile.int_size;
45 |
46 | ascii = new byte [size-1];
47 | System.arraycopy (data,offset,ascii,0,size-1); }
48 |
49 | /* end class ICCTextDescriptionType */ }
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/src/jj2000/icc/ICCMonochromeInputProfile.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCMonochromeInputProfile.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc;
10 |
11 | import java.io.InputStream;
12 | import java.io.File;
13 | import java.io.IOException;
14 | import jj2000.colorspace .ColorSpace;
15 | import jj2000.colorspace .ColorSpaceException;
16 | import jj2000.j2k.io.RandomAccessIO;
17 |
18 | /**
19 | * The monochrome ICCProfile.
20 | *
21 | * @version 1.0
22 | * @author Bruce A. Kern
23 | */
24 | public class ICCMonochromeInputProfile extends ICCProfile {
25 |
26 | /**
27 | * Return the ICCProfile embedded in the input image
28 | * @param in jp2 image with embedded profile
29 | * @return ICCMonochromeInputProfile
30 | * @exception ColorSpaceICCProfileInvalidExceptionException
31 | * @exception
32 | */
33 | public static ICCMonochromeInputProfile createInstance (ColorSpace csm)
34 | throws ColorSpaceException, ICCProfileInvalidException {
35 | return new ICCMonochromeInputProfile (csm); }
36 |
37 | /**
38 | * Construct a ICCMonochromeInputProfile corresponding to the profile file
39 | * @param f disk based ICCMonochromeInputProfile
40 | * @return theICCMonochromeInputProfile
41 | * @exception ColorSpaceException
42 | * @exception ICCProfileInvalidException
43 | */
44 | protected ICCMonochromeInputProfile (ColorSpace csm)
45 | throws ColorSpaceException, ICCProfileInvalidException {
46 | super (csm); }
47 |
48 | /* end class ICCMonochromeInputProfile */ }
49 |
--------------------------------------------------------------------------------
/src/jj2000/icc/types/ICCDateTime.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCDateTime.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.types;
10 |
11 | import java.io.IOException;
12 | import java.io.RandomAccessFile;
13 | import jj2000.icc.ICCProfile;
14 |
15 | /**
16 | * Date Time format for tags
17 | *
18 | * @version 1.0
19 | * @author Bruce A. Kern
20 | */
21 | public class ICCDateTime
22 | {
23 | public final static int size = 6 * ICCProfile.short_size;
24 |
25 | /** Year datum. */ public short wYear; // Number of the actual year (i.e. 1994)
26 | /** Month datum. */ public short wMonth; // Number of the month (1-12)
27 | /** Day datum. */ public short wDay; // Number of the day
28 | /** Hour datum. */ public short wHours; // Number of hours (0-23)
29 | /** Minute datum. */ public short wMinutes; // Number of minutes (0-59)
30 | /** Second datum. */ public short wSeconds; // Number of seconds (0-59)
31 |
32 | /** Construct an ICCDateTime from parts */
33 | public ICCDateTime (short year, short month, short day, short hour, short minute, short second) {
34 | wYear = year; wMonth = month; wDay = day;
35 | wHours = hour; wMinutes = minute; wSeconds = second; }
36 |
37 | /** Write an ICCDateTime to a file. */
38 | public void write (RandomAccessFile raf) throws IOException {
39 | raf.writeShort(wYear);
40 | raf.writeShort(wMonth);
41 | raf.writeShort(wDay);
42 | raf.writeShort(wHours);
43 | raf.writeShort(wMinutes);
44 | raf.writeShort(wSeconds); }
45 |
46 | /* end class ICCDateTime*/ }
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/jj2000/icc/ICCMatrixBasedInputProfile.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCMatrixBasedInputProfile.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc;
10 |
11 | import java.io.InputStream;
12 | import java.io.File;
13 | import java.io.IOException;
14 | import jj2000.colorspace .ColorSpace;
15 | import jj2000.colorspace .ColorSpaceException;
16 | import jj2000.j2k.io.RandomAccessIO;
17 |
18 | /**
19 | * This class enables an application to construct an 3 component ICCProfile
20 | *
21 | * @version 1.0
22 | * @author Bruce A. Kern
23 | */
24 |
25 | public class ICCMatrixBasedInputProfile extends ICCProfile {
26 |
27 | /**
28 | * Factory method to create ICCMatrixBasedInputProfile based on a
29 | * suppled profile file.
30 | * @param f contains a disk based ICCProfile.
31 | * @return the ICCMatrixBasedInputProfile
32 | * @exception ICCProfileInvalidException
33 | * @exception ColorSpaceException
34 | */
35 | public static ICCMatrixBasedInputProfile createInstance (ColorSpace csm)
36 | throws ColorSpaceException, ICCProfileInvalidException {
37 | return new ICCMatrixBasedInputProfile (csm); }
38 |
39 | /**
40 | * Construct an ICCMatrixBasedInputProfile based on a
41 | * suppled profile file.
42 | * @param f contains a disk based ICCProfile.
43 | * @exception ColorSpaceException
44 | * @exception ICCProfileInvalidException
45 | */
46 | protected ICCMatrixBasedInputProfile (ColorSpace csm)
47 | throws ColorSpaceException, ICCProfileInvalidException {
48 | super (csm); }
49 |
50 | /* end class ICCMatrixBasedInputProfile */ }
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/src/jj2000/icc/lut/LookUpTableFP.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: LookUpTableFP.java 166 2012-01-11 23:48:05Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.lut;
10 |
11 | import jj2000.icc.tags.ICCCurveType;
12 |
13 | /**
14 | * Toplevel class for a float [] lut.
15 | *
16 | * @version 1.0
17 | * @author Bruce A. Kern
18 | */
19 | public abstract class LookUpTableFP extends LookUpTable {
20 |
21 | /** The lut values. */ public final float [] lut;
22 |
23 | /**
24 | * Factory method for getting a lut from a given curve.
25 | * @param curve the data
26 | * @param dwNumInput the size of the lut
27 | * @return the lookup table
28 | */
29 |
30 | public static LookUpTableFP createInstance (
31 | ICCCurveType curve, // Pointer to the curve data
32 | int dwNumInput // Number of input values in created LUT
33 | ) {
34 |
35 | if (curve.nEntries == 1) return new LookUpTableFPGamma (curve, dwNumInput);
36 | else return new LookUpTableFPInterp (curve, dwNumInput); }
37 |
38 | /**
39 | * Construct an empty lut
40 | * @param dwNumInput the size of the lut t lut.
41 | * @param dwMaxOutput max output value of the lut
42 | */
43 | protected LookUpTableFP (
44 | ICCCurveType curve, // Pointer to the curve data
45 | int dwNumInput // Number of input values in created LUT
46 | ) {
47 | super (curve, dwNumInput);
48 | lut = new float [dwNumInput]; }
49 |
50 | /**
51 | * lut accessor
52 | * @param index of the element
53 | * @return the lut [index]
54 | */
55 | public final float elementAt ( int index ) {
56 | return lut [index]; }
57 |
58 | /* end class LookUpTableFP */ }
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/src/jj2000/colorspace/boxes/ImageHeaderBox.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ImageHeaderBox.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.colorspace.boxes;
10 |
11 | import jj2000.colorspace.ColorSpaceException;
12 | import jj2000.j2k.io.RandomAccessIO;
13 | import jj2000.icc.ICCProfile;
14 |
15 | import java.io.IOException;
16 |
17 | /**
18 | * This class models the Image Header box contained in a JP2
19 | * image. It is a stub class here since for colormapping the
20 | * knowlege of the existance of the box in the image is sufficient.
21 | *
22 | * @version 1.0
23 | * @author Bruce A. Kern
24 | */
25 | public final class ImageHeaderBox extends JP2Box
26 | {
27 | static { type = 69686472; }
28 |
29 | long height;
30 | long width;
31 | int nc;
32 | short bpc;
33 | short c;
34 | boolean unk;
35 | boolean ipr;
36 |
37 |
38 | /**
39 | * Construct an ImageHeaderBox from an input image.
40 | * @param in RandomAccessIO jp2 image
41 | * @param boxStart offset to the start of the box in the image
42 | * @exception IOException, ColorSpaceException
43 | */
44 | public ImageHeaderBox (RandomAccessIO in, int boxStart)
45 | throws IOException, ColorSpaceException {
46 | super (in, boxStart);
47 | readBox(); }
48 |
49 |
50 | /** Analyze the box content. */
51 | void readBox() throws IOException {
52 | byte [] bfr = new byte [14];
53 | in.seek(dataStart);
54 | in.readFully (bfr,0,14);
55 |
56 | height = ICCProfile.getInt(bfr,0);
57 | width = ICCProfile.getInt(bfr,4);
58 | nc = ICCProfile.getShort(bfr,8);
59 | bpc = (short) (bfr[10] & 0x00ff);
60 | c = (short) (bfr[11] & 0x00ff);
61 | unk = bfr[12]==0?true:false;
62 | ipr = bfr[13]==1?true:false; }
63 |
64 | /* end class ImageHeaderBox */ }
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/jj2000/icc/MatrixBasedRestrictedProfile.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: MatrixBasedRestrictedProfile.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc;
10 |
11 | import jj2000.icc.tags.ICCCurveType;
12 | import jj2000.icc.tags.ICCXYZType;
13 |
14 | /**
15 | * This class is a 3 component RestrictedICCProfile
16 | *
17 | * @version 1.0
18 | * @author Bruce A Kern
19 | */
20 | public class MatrixBasedRestrictedProfile extends RestrictedICCProfile {
21 |
22 | /**
23 | * Factory method which returns a 3 component RestrictedICCProfile
24 | * @param rcurve Red TRC curve
25 | * @param gcurve Green TRC curve
26 | * @param bcurve Blue TRC curve
27 | * @param rcolorant Red colorant
28 | * @param gcolorant Green colorant
29 | * @param bcolorant Blue colorant
30 | * @return the RestrictedICCProfile
31 | */
32 | public static RestrictedICCProfile createInstance (ICCCurveType rcurve, ICCCurveType gcurve, ICCCurveType bcurve,
33 | ICCXYZType rcolorant, ICCXYZType gcolorant, ICCXYZType bcolorant) {
34 | return new MatrixBasedRestrictedProfile(rcurve,gcurve,bcurve,rcolorant,gcolorant,bcolorant); }
35 |
36 | /**
37 | * Construct a 3 component RestrictedICCProfile
38 | * @param rcurve Red TRC curve
39 | * @param gcurve Green TRC curve
40 | * @param bcurve Blue TRC curve
41 | * @param rcolorant Red colorant
42 | * @param gcolorant Green colorant
43 | * @param bcolorant Blue colorant
44 | */
45 | protected MatrixBasedRestrictedProfile (ICCCurveType rcurve, ICCCurveType gcurve, ICCCurveType bcurve,
46 | ICCXYZType rcolorant, ICCXYZType gcolorant, ICCXYZType bcolorant) {
47 | super (rcurve, gcurve, bcurve, rcolorant, gcolorant, bcolorant); }
48 |
49 | /**
50 | * Get the type of RestrictedICCProfile for this object
51 | * @return kThreeCompInput
52 | */
53 | public int getType () {return kThreeCompInput;}
54 |
55 | /* end class MatrixBasedRestrictedProfile */ }
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/jj2000/icc/tags/ICCXYZType.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCXYZType.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.tags;
10 |
11 | import java.io.IOException;
12 | import java.io.RandomAccessFile;
13 | import jj2000.icc.ICCProfile;
14 |
15 | /**
16 | * A tag containing a triplet.
17 | *
18 | * @see jj2000.j2k.icc.tags.ICCXYZTypeReverse
19 | * @see jj2000.j2k.icc.types.XYZNumber
20 | * @version 1.0
21 | * @author Bruce A. Kern
22 | */
23 | public class ICCXYZType extends ICCTag {
24 |
25 | /** x component */ public final long x;
26 | /** y component */ public final long y;
27 | /** z component */ public final long z;
28 |
29 | /** Normalization utility */
30 | public static long DoubleToXYZ ( double x ) {
31 | return (long) Math.floor(x * 65536.0 + 0.5); }
32 |
33 | /** Normalization utility */
34 | public static double XYZToDouble (long x) {
35 | return x / 65536.0; }
36 |
37 | /**
38 | * Construct this tag from its constituant parts
39 | * @param signature tag id
40 | * @param data array of bytes
41 | * @param offset to data in the data array
42 | * @param length of data in the data array
43 | */
44 | protected ICCXYZType (int signature, byte [] data, int offset, int length) {
45 | super (signature, data, offset, length);
46 | x=ICCProfile.getInt (data, offset+2*ICCProfile.int_size);
47 | y=ICCProfile.getInt (data, offset+3*ICCProfile.int_size);
48 | z=ICCProfile.getInt (data, offset+4*ICCProfile.int_size); }
49 |
50 |
51 | /** Write to a file. */
52 | public void write (RandomAccessFile raf) throws IOException {
53 | byte [] xb = ICCProfile.setLong (x);
54 | byte [] yb = ICCProfile.setLong (y);
55 | byte [] zb = ICCProfile.setLong (z);
56 |
57 | raf.write (xb, ICCProfile.int_size, 0);
58 | raf.write (yb, ICCProfile.int_size, 0);
59 | raf.write (zb, ICCProfile.int_size, 0); }
60 |
61 |
62 | /* end class ICCXYZType */ }
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/src/jj2000/icc/lut/LookUpTableFPInterp.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: LookUpTableFPInterp.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.lut;
10 |
11 | import jj2000.icc.tags.ICCCurveType;
12 |
13 | /**
14 | * An interpolated floating point lut
15 | *
16 | * @version 1.0
17 | * @author Bruce A.Kern
18 | */
19 | public class LookUpTableFPInterp extends LookUpTableFP {
20 |
21 | /**
22 | * Construct the lut from the curve data
23 | * @oaram curve the data
24 | * @oaram dwNumInput the lut size
25 | */
26 | public LookUpTableFPInterp (
27 | ICCCurveType curve, // Pointer to the curve data
28 | int dwNumInput // Number of input values in created LUT
29 | ) {
30 | super (curve, dwNumInput);
31 |
32 | int dwLowIndex, dwHighIndex; // Indices of interpolation points
33 | double dfLowIndex, dfHighIndex; // FP indices of interpolation points
34 | double dfTargetIndex; // Target index into interpolation table
35 | double dfRatio; // Ratio of LUT input points to curve values
36 | double dfLow, dfHigh; // Interpolation values
37 |
38 | dfRatio = (double)(curve.nEntries-1) / (double)(dwNumInput-1);
39 |
40 | for (int i = 0; i < dwNumInput; i++) {
41 | dfTargetIndex = (double) i * dfRatio;
42 | dfLowIndex = Math.floor(dfTargetIndex);
43 | dwLowIndex = (int) dfLowIndex;
44 | dfHighIndex = Math.ceil(dfTargetIndex);
45 | dwHighIndex = (int) dfHighIndex;
46 | if (dwLowIndex == dwHighIndex) lut[i] = (float) ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
47 | else {
48 | dfLow = ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
49 | dfHigh = ICCCurveType.CurveToDouble(curve.entry(dwHighIndex));
50 | lut[i] = (float) (dfLow + (dfHigh - dfLow) * (dfTargetIndex - dfLowIndex)); }}}
51 |
52 | /* end class LookUpTableFPInterp */ }
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/src/jj2000/icc/tags/ICCCurveType.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCCurveType.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.tags;
10 |
11 | import jj2000.icc.ICCProfile;
12 |
13 | /**
14 | * The ICCCurve tag
15 | *
16 | * @version 1.0
17 | * @author Bruce A. Kern
18 | */
19 | public class ICCCurveType extends ICCTag {
20 |
21 | private static final String eol = System.getProperty ("line.separator");
22 | /** Tag fields */ public final int type;
23 | /** Tag fields */ public final int reserved;
24 | /** Tag fields */ public final int nEntries;
25 | /** Tag fields */ public final int [] entry;
26 |
27 |
28 | /** Normalization utility */
29 | public static double CurveToDouble(int entry)
30 | { return (double) entry / 65535.0; }
31 |
32 | /** Normalization utility */
33 | public static short DoubleToCurve(double entry)
34 | { return (short) Math.floor(entry * 65535.0 + 0.5); }
35 |
36 | /** Normalization utility */
37 | public static double CurveGammaToDouble(int entry)
38 | { return (double)entry / 256.0; }
39 |
40 |
41 | /**
42 | * Construct this tag from its constituant parts
43 | * @param signature tag id
44 | * @param data array of bytes
45 | * @param offset to data in the data array
46 | * @param length of data in the data array
47 | */
48 | protected ICCCurveType (int signature, byte [] data, int offset, int length) {
49 | super (signature, data, offset, offset+2*ICCProfile.int_size);
50 | type = ICCProfile.getInt (data, offset);
51 | reserved = ICCProfile.getInt (data, offset+ICCProfile.int_size);
52 | nEntries = ICCProfile.getInt (data, offset+2*ICCProfile.int_size);
53 | entry = new int [nEntries];
54 | for (int i=0; i
5 | *
6 | * Copyright (c) 2012 Michael Roland
7 | *
8 | * ALL RIGHTS RESERVED.
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * * Redistributions of source code must retain the above copyright
14 | * notice, this list of conditions and the following disclaimer.
15 | * * Redistributions in binary form must reproduce the above copyright
16 | * notice, this list of conditions and the following disclaimer in the
17 | * documentation and/or other materials provided with the distribution.
18 | * * Neither the name Michael Roland nor the names of any contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL MICHAEL ROLAND BE LIABLE FOR ANY
26 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | */
33 |
34 | package jj2000;
35 |
36 | import jj2000.j2k.decoder.Decoder;
37 | import jj2000.j2k.util.ParameterList;
38 | import android.graphics.Bitmap;
39 |
40 | /**
41 | * Frontend for JJ2000 library.
42 | */
43 | public class JJ2000Frontend {
44 | /** The parameter info, with all possible options. */
45 | private static String pinfoDecoder[][] = Decoder.getAllParameters();
46 |
47 | public static Bitmap decode(byte[] input) {
48 | // Get the dfault parameter values
49 | ParameterList defpl = new ParameterList();
50 | for (int i = pinfoDecoder.length - 1; i >= 0; --i) {
51 | if (pinfoDecoder[i][3] != null) {
52 | defpl.put(pinfoDecoder[i][0], pinfoDecoder[i][3]);
53 | }
54 | }
55 |
56 | ParameterList pl = new ParameterList(defpl);
57 |
58 | //pl.setProperty("rate", "3");
59 |
60 | Decoder dec = new Decoder(pl);
61 | return dec.run(input);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/jj2000/j2k/wavelet/FilterTypes.java:
--------------------------------------------------------------------------------
1 | /*
2 | * CVS identifier:
3 | *
4 | * $Id: FilterTypes.java 166 2012-01-11 23:48:05Z mroland $
5 | *
6 | * Class: FilterTypes
7 | *
8 | * Description: Defines the interface for Filter types
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.wavelet;
44 |
45 | /**
46 | * This interface defines the identifiers for the different types of filters
47 | * that are supported.
48 | *
49 | *
The identifier values are the same as those used in the codestream
50 | * syntax, for the filters that are defined in the standard.
51 | * */
52 | public interface FilterTypes {
53 |
54 | /** W7x9 filter: 0x00 */
55 | public final static int W9X7 = 0;
56 |
57 | /** W5x3 filter: 0x01 */
58 | public final static int W5X3 = 1;
59 |
60 | /** User-defined filter: -1 */
61 | public final static int CUSTOM = -1;
62 | }
63 |
--------------------------------------------------------------------------------
/src/jj2000/j2k/util/StringFormatException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * CVS identifier:
3 | *
4 | * $Id: StringFormatException.java 166 2012-01-11 23:48:05Z mroland $
5 | *
6 | * Class: ArgumentFormatException
7 | *
8 | * Description: Exception for badly formatted string
9 | * argument exceptions.
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.util;
50 |
51 | /**
52 | * Thrown to indicate that the application has attempted to parse a
53 | * badly formatted string.
54 | * */
55 | public class StringFormatException extends IllegalArgumentException {
56 |
57 | /**
58 | * Creates the exception with an empty messgage.
59 | *
60 | *
61 | * */
62 | public StringFormatException() {
63 | super();
64 | }
65 |
66 | /**
67 | * Creates the exception with the specified detail message.
68 | *
69 | * @param s The detail message
70 | *
71 | *
72 | * */
73 | public StringFormatException(String s) {
74 | super(s);
75 | }
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/src/jj2000/colorspace/boxes/ComponentMappingBox.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ComponentMappingBox.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.colorspace.boxes;
10 |
11 | import jj2000.colorspace.ColorSpaceException;
12 | import jj2000.icc.ICCProfile;
13 | import jj2000.j2k.io.RandomAccessIO;
14 |
15 | import java.io.IOException;
16 | import java.util.Vector;
17 |
18 | /**
19 | * This class maps the components in the codestream
20 | * to channels in the image. It models the Component
21 | * Mapping box in the JP2 header.
22 | *
23 | * @version 1.0
24 | * @author Bruce A. Kern
25 | */
26 | public final class ComponentMappingBox extends JP2Box
27 | {
28 | static { type = 0x636d6170; }
29 |
30 | private int nChannels;
31 | private Vector map = new Vector();
32 |
33 | /**
34 | * Construct a ComponentMappingBox from an input image.
35 | * @param in RandomAccessIO jp2 image
36 | * @param boxStart offset to the start of the box in the image
37 | * @exception IOException, ColorSpaceException
38 | */
39 | public ComponentMappingBox (RandomAccessIO in, int boxStart)
40 | throws IOException, ColorSpaceException {
41 | super (in, boxStart);
42 | readBox(); }
43 |
44 | /** Analyze the box content. */
45 | void readBox() throws IOException {
46 | nChannels = (boxEnd-dataStart) / 4;
47 | in.seek(dataStart);
48 | for (int offset=dataStart; offsetNoNextElementException exception with no
60 | * detail message.
61 | *
62 | *
63 | */
64 | public NoNextElementException() {
65 | super();
66 | }
67 |
68 | /**
69 | * Constructs a new NoNextElementException exception with
70 | * the specified detail message.
71 | *
72 | * @param s The detail message.
73 | *
74 | * */
75 | public NoNextElementException(String s) {
76 | super(s);
77 | }
78 |
79 | }
80 |
81 |
82 |
--------------------------------------------------------------------------------
/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/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/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/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:
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.wavelet.synthesis;
44 |
45 | /**
46 | * This interface extends the MultiResImgData interface with the methods that
47 | * are necessary for inverse wavelet data (i.e. data that is the source to an
48 | * inverse wavlet trasnform).
49 | * */
50 | public interface InvWTData extends MultiResImgData {
51 |
52 | /**
53 | * Returns the subband tree, for the specified tile-component. This method
54 | * returns the root element of the subband tree structure, see 'Subband'
55 | * and 'SubbandSyn'. The tree comprises all the available resolution
56 | * levels.
57 | *
58 | * @param t The index of the tile, from 0 to T-1.
59 | *
60 | * @param c The index of the component, from 0 to C-1.
61 | *
62 | * @return The root of the tree structure.
63 | * */
64 | public SubbandSyn getSynSubbandTree(int t,int c);
65 |
66 | /**
67 | * Returns the horizontal code-block partition origin. Allowable values
68 | * are 0 and 1, nothing else.
69 | * */
70 | public int getCbULX();
71 |
72 | /**
73 | * Returns the vertical code-block partition origin Allowable values are 0
74 | * and 1, nothing else.
75 | * */
76 | public int getCbULY();
77 | }
78 |
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
17 |
18 |
29 |
30 |
31 |
35 |
36 |
37 |
38 |
44 |
45 |
48 |
49 |
59 |
60 |
61 |
62 |
66 |
67 |
68 |
69 |
75 |
76 |
81 |
82 |
89 |
90 |
98 |
99 |
--------------------------------------------------------------------------------
/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/NotImplementedError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * CVS Identifier:
3 | *
4 | * $Id: NotImplementedError.java 166 2012-01-11 23:48:05Z mroland $
5 | *
6 | * Class: NotImplementedError
7 | *
8 | * Description: Exception that is thrown whenever a non-implemented
9 | * method is called.
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;
49 |
50 | /**
51 | * This exception is thrown whenever a feature or functionality that
52 | * has not been implemented is calle.
53 | *
54 | *
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/colorspace/boxes/ColorSpecificationBox.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ColorSpecificationBox.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 | package jj2000.colorspace.boxes;
9 |
10 | import jj2000.j2k.io.*;
11 |
12 | import jj2000.colorspace.*;
13 | import jj2000.icc.*;
14 |
15 | import java.io.*;
16 |
17 | /**
18 | * This class models the Color Specification Box in a JP2 image.
19 | *
20 | * @version 1.0
21 | * @author Bruce A. Kern
22 | */
23 | public final class ColorSpecificationBox extends JP2Box {
24 | static { type = 0x636f6c72; }
25 |
26 | private ColorSpace.MethodEnum method = null;
27 | private ColorSpace.CSEnum colorSpace = null;
28 | private byte[] iccProfile = null;
29 |
30 | /**
31 | * Construct a ColorSpecificationBox from an input image.
32 | * @param in RandomAccessIO jp2 image
33 | * @param boxStart offset to the start of the box in the image
34 | * @exception IOException, ColorSpaceException
35 | * */
36 | public ColorSpecificationBox (RandomAccessIO in, int boxStart)
37 | throws IOException, ColorSpaceException {
38 | super(in,boxStart);
39 | readBox();
40 | }
41 |
42 | /** Analyze the box content. */
43 | private void readBox() throws IOException, ColorSpaceException {
44 | byte[] boxHeader = new byte[256];
45 | in.seek (dataStart);
46 | in.readFully(boxHeader,0,11);
47 | switch (boxHeader[0]) {
48 | case 1:
49 | method = ColorSpace.ENUMERATED;
50 | int cs = ICCProfile.getInt(boxHeader,3);
51 | switch (cs) {
52 | case 16:
53 | colorSpace = ColorSpace.sRGB;
54 | break; // from switch (cs)...
55 | case 17:
56 | colorSpace = ColorSpace.GreyScale;
57 | break; // from switch (cs)...
58 | case 18:
59 | colorSpace = ColorSpace.sYCC;
60 | break; // from switch (cs)...
61 | default:
62 | colorSpace = ColorSpace.Unknown;
63 | }
64 | break; // from switch (boxHeader[0])...
65 | case 2:
66 | method = ColorSpace.ICC_PROFILED;
67 | int size = ICCProfile.getInt (boxHeader, 3);
68 | iccProfile = new byte [size];
69 | in.seek(dataStart+3);
70 | in.readFully (iccProfile,0,size);
71 | break; // from switch (boxHeader[0])...
72 | default:
73 | throw new ColorSpaceException ("Bad specification method ("+
74 | boxHeader[0]+") in " + this);
75 | }
76 | }
77 |
78 | /* Return an enumeration for the colorspace method. */
79 | public ColorSpace.MethodEnum getMethod () {
80 | return method; }
81 |
82 | /* Return an enumeration for the colorspace. */
83 | public ColorSpace.CSEnum getColorSpace () {
84 | return colorSpace; }
85 |
86 | /* Return a String representation of the colorspace. */
87 | public String getColorSpaceString () {
88 | return colorSpace.value; }
89 |
90 | /* Return a String representation of the colorspace method. */
91 | public String getMethodString () {
92 | return method.value; }
93 |
94 | /* Retrieve the ICC Profile from the image as a byte []. */
95 | public byte [] getICCProfile () {
96 | return iccProfile; }
97 |
98 |
99 | /* end class ColorSpecificationBox */ }
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/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/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/icc/lut/LookUpTable32LinearSRGBtoSRGB.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: LookUpTable32LinearSRGBtoSRGB.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.lut;
10 |
11 | /**
12 | * A Linear 32 bit SRGB to SRGB lut
13 | *
14 | * @version 1.0
15 | * @author Bruce A. Kern
16 | */
17 | public class LookUpTable32LinearSRGBtoSRGB extends LookUpTable32 {
18 |
19 | /**
20 | * Factory method for creating the lut.
21 | * @param wShadowCutoff size of shadow region
22 | * @param dfShadowSlope shadow region parameter
23 | * @param ksRGBLinearMaxValue size of lut
24 | * @param ksRGB8ScaleAfterExp post shadow region parameter
25 | * @param ksRGBExponent post shadow region parameter
26 | * @param ksRGB8ReduceAfterEx post shadow region parameter
27 | * @return the lut
28 | */
29 | public static LookUpTable32LinearSRGBtoSRGB createInstance (
30 | int inMax,
31 | int outMax,
32 | double shadowCutoff,
33 | double shadowSlope,
34 | double scaleAfterExp,
35 | double exponent,
36 | double reduceAfterExp) {
37 | return new LookUpTable32LinearSRGBtoSRGB
38 | (inMax, outMax,
39 | shadowCutoff, shadowSlope,
40 | scaleAfterExp, exponent, reduceAfterExp);
41 | }
42 |
43 | /**
44 | * Construct the lut
45 | * @param wShadowCutoff size of shadow region
46 | * @param dfShadowSlope shadow region parameter
47 | * @param ksRGBLinearMaxValue size of lut
48 | * @param ksRGB8ScaleAfterExp post shadow region parameter
49 | * @param ksRGBExponent post shadow region parameter
50 | * @param ksRGB8ReduceAfterExp post shadow region parameter
51 | */
52 | protected LookUpTable32LinearSRGBtoSRGB
53 | (
54 | int inMax,
55 | int outMax,
56 | double shadowCutoff,
57 | double shadowSlope,
58 | double scaleAfterExp,
59 | double exponent,
60 | double reduceAfterExp) {
61 |
62 | super (inMax+1, outMax);
63 |
64 | int i=-1;
65 | // Normalization factor for i.
66 | double normalize = 1.0 / (double)inMax;
67 |
68 | // Generate the final linear-sRGB to non-linear sRGB LUT
69 |
70 | // calculate where shadow portion of lut ends.
71 | int cutOff = (int)Math.floor(shadowCutoff*inMax);
72 |
73 | // Scale to account for output
74 | shadowSlope *= outMax;
75 |
76 | // Our output needs to be centered on zero so we shift it down.
77 | int shift = (outMax+1)/2;
78 |
79 | for (i = 0; i <= cutOff; i++)
80 | lut[i] = (int)(Math.floor(shadowSlope*(i*normalize) + 0.5) - shift);
81 |
82 | // Scale values for output.
83 | scaleAfterExp *= outMax;
84 | reduceAfterExp *= outMax;
85 |
86 | // Now calculate the rest
87 | for (; i <= inMax; i++)
88 | lut[i] = (int)(Math.floor(scaleAfterExp *
89 | Math.pow(i*normalize, exponent)
90 | - reduceAfterExp + 0.5) - shift);
91 | }
92 |
93 | /* end class LookUpTable32LinearSRGBtoSRGB */ }
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/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/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/colorspace/boxes/ChannelDefinitionBox.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ChannelDefinitionBox.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.colorspace.boxes;
10 |
11 | import jj2000.colorspace.ColorSpaceException;
12 | import jj2000.icc.ICCProfile;
13 | import jj2000.j2k.io.RandomAccessIO;
14 |
15 | import java.io.IOException;
16 | import java.util.Hashtable;
17 | import java.util.Enumeration;
18 |
19 | /**
20 | * This class maps the components in the codestream
21 | * to channels in the image. It models the Component
22 | * Mapping box in the JP2 header.
23 | *
24 | * @version 1.0
25 | * @author Bruce A. Kern
26 | */
27 | public final class ChannelDefinitionBox extends JP2Box
28 | {
29 | static { type = 0x63646566; }
30 |
31 | private int ndefs;
32 | private Hashtable definitions = new Hashtable();
33 |
34 | /**
35 | * Construct a ChannelDefinitionBox from an input image.
36 | * @param in RandomAccessIO jp2 image
37 | * @param boxStart offset to the start of the box in the image
38 | * @exception IOException, ColorSpaceException
39 | */
40 | public ChannelDefinitionBox (RandomAccessIO in, int boxStart)
41 | throws IOException, ColorSpaceException {
42 | super (in, boxStart);
43 | readBox(); }
44 |
45 | /** Analyze the box content. */
46 | private void readBox() throws IOException {
47 |
48 | byte [] bfr = new byte [8];
49 |
50 | in.seek(dataStart);
51 | in.readFully (bfr,0,2);
52 | ndefs = ICCProfile.getShort(bfr,0) & 0x0000ffff;
53 |
54 | int offset = dataStart+2;
55 | in.seek (offset);
56 | for (int i=0; iThe 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/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/colorspace/boxes/PaletteBox.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: PaletteBox.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.colorspace.boxes;
10 |
11 | import jj2000.colorspace.ColorSpaceException;
12 | import jj2000.icc.ICCProfile;
13 | import jj2000.j2k.io.RandomAccessIO;
14 |
15 | import java.io.IOException;
16 |
17 | /**
18 | * This class models the palette box contained in a JP2
19 | * image.
20 | *
21 | * @version 1.0
22 | * @author Bruce A. Kern
23 | */
24 | public final class PaletteBox extends JP2Box
25 | {
26 | static { type = 0x70636c72; }
27 |
28 | private int nentries;
29 | private int ncolumns;
30 | private short [] bitdepth;
31 | private int [][] entries;
32 |
33 | /**
34 | * Construct a PaletteBox from an input image.
35 | * @param in RandomAccessIO jp2 image
36 | * @param boxStart offset to the start of the box in the image
37 | * @exception IOException, ColorSpaceException
38 | */
39 | public PaletteBox (RandomAccessIO in, int boxStart)
40 | throws IOException, ColorSpaceException {
41 | super (in, boxStart);
42 | readBox(); }
43 |
44 | /** Analyze the box content. */
45 | void readBox()
46 | throws IOException, ColorSpaceException {
47 | byte [] bfr = new byte [4];
48 | int i,j,b,m;
49 | int entry;
50 |
51 | // Read the number of palette entries and columns per entry.
52 | in.seek((int)dataStart);
53 | in.readFully (bfr,0,3);
54 | nentries = ICCProfile.getShort(bfr,0) & 0x0000ffff;
55 | ncolumns = bfr[2] & 0x0000ffff;
56 |
57 | // Read the bitdepths for each column
58 | bitdepth = new short [ncolumns];
59 | bfr = new byte [ncolumns];
60 | in.readFully (bfr,0,ncolumns);
61 | for (i=0; 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/icc/tags/ICCTagTable.java:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | *
3 | * $Id: ICCTagTable.java 169 2012-01-15 18:33:24Z mroland $
4 | *
5 | * Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | * $Date $
7 | *****************************************************************************/
8 |
9 | package jj2000.icc.tags;
10 |
11 | import java.io.IOException;
12 | import java.io.RandomAccessFile;
13 | import java.util.Vector;
14 | import java.util.Enumeration;
15 | import java.util.Hashtable;
16 | import jj2000.icc .ICCProfile;
17 | import jj2000.icc.types.ICCProfileHeader;
18 |
19 | /**
20 | * This class models an ICCTagTable as a HashTable which maps
21 | * ICCTag signatures (as Integers) to ICCTags.
22 | *
23 | * On disk the tag table exists as a byte array conventionally aggragted into a
24 | * structured sequence of types (bytes, shorts, ints, and floats. The first four bytes
25 | * are the integer count of tags in the table. This is followed by an array of triplets,
26 | * one for each tag. The triplets each contain three integers, which are the tag signature,
27 | * the offset of the tag in the byte array and the length of the tag in bytes.
28 | * The tag data follows. Each tag consists of an integer (4 bytes) tag type, a reserved integer
29 | * and the tag data, which varies depending on the tag.
30 | *
31 | * @see jj2000.j2k.icc.tags.ICCTag
32 | * @version 1.0
33 | * @author Bruce A. Kern
34 | */
35 | public class ICCTagTable extends Hashtable
36 | {
37 | private static final String eol = System.getProperty("line.separator");
38 | private static final int offTagCount = ICCProfileHeader.size;
39 | private static final int offTags = offTagCount + ICCProfile.int_size;
40 |
41 | private final Vector trios = new Vector ();
42 |
43 | private int tagCount;
44 |
45 |
46 | static private class Triplet {
47 | /** Tag identifier */ private int signature;
48 | /** absolute offset of tag data */ private int offset;
49 | /** length of tag data */ private int count;
50 | /** size of an entry */ public static final int size = 3*ICCProfile.int_size;
51 |
52 |
53 | Triplet (int signature, int offset, int count) {
54 | this.signature = signature;
55 | this.offset = offset;
56 | this.count = count; }}
57 |
58 |
59 |
60 | /**
61 | * Factory method for creating a tag table from raw input.
62 | * @param byte array of unstructured data representing a tag
63 | * @return ICCTagTable
64 | */
65 | public static ICCTagTable createInstance (byte [] data) {
66 | ICCTagTable tags = new ICCTagTable(data);
67 | return tags; }
68 |
69 |
70 | /**
71 | * Ctor used by factory method.
72 | * @param byte raw tag data
73 | */
74 | protected ICCTagTable (byte [] data) {
75 | tagCount = ICCProfile.getInt(data,offTagCount);
76 |
77 | int offset=offTags;
78 | for (int i=0; iThe 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 |
--------------------------------------------------------------------------------
/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/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=0; i--) { // Set elements
122 | arr[i] = val;
123 | }
124 | }
125 | else { // Do in optimized way
126 | len2 = len>>1;
127 | for (i=0; idwInputMaxValue) j=dwInputMaxValue;
105 | out[i] = lut[j]; }}
106 |
107 | /**
108 | * Populate the output block by looking up the values in the lut, using the input
109 | * as lut indices.
110 | * @param inb input samples
111 | * @param outb output samples.
112 | * @exception MonochromeTransformException
113 | */
114 | public void apply (DataBlkFloat inb, DataBlkFloat outb)
115 | throws MonochromeTransformException {
116 |
117 | int i,j,x,y,o;
118 |
119 | float [] in = (float []) inb.getData();
120 | float [] out = (float []) outb.getData();
121 |
122 |
123 | if (out==null || out.length < in.length) {
124 | out = new float [in.length];
125 | outb.setData(out);
126 |
127 | outb.uly = inb.uly;
128 | outb.ulx = inb.ulx;
129 | outb.h = inb.h;
130 | outb.w = inb.w;
131 | outb.offset = inb.offset;
132 | outb.scanw = inb.scanw;}
133 |
134 | o=inb.offset;
135 | for (i=0; idwInputMaxValue) j=dwInputMaxValue;
139 | out[i] = lut[j]; }}
140 |
141 |
142 | /* end class MonochromeTransformTosRGB */ }
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------