001/*
002 * $RCSfile: Markers.java,v $
003 * $Revision: 1.1 $
004 * $Date: 2005/02/11 05:02:00 $
005 * $State: Exp $
006 *
007 * Class:                   Markers
008 *
009 * Description: Defines the values of the markers in JPEG 2000 codestream
010 *
011 * COPYRIGHT:
012 *
013 * This software module was originally developed by Raphaël Grosbois and
014 * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel
015 * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David
016 * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research
017 * Centre France S.A) in the course of development of the JPEG2000
018 * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This
019 * software module is an implementation of a part of the JPEG 2000
020 * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio
021 * Systems AB and Canon Research Centre France S.A (collectively JJ2000
022 * Partners) agree not to assert against ISO/IEC and users of the JPEG
023 * 2000 Standard (Users) any of their rights under the copyright, not
024 * including other intellectual property rights, for this software module
025 * with respect to the usage by ISO/IEC and Users of this software module
026 * or modifications thereof for use in hardware or software products
027 * claiming conformance to the JPEG 2000 Standard. Those intending to use
028 * this software module in hardware or software products are advised that
029 * their use may infringe existing patents. The original developers of
030 * this software module, JJ2000 Partners and ISO/IEC assume no liability
031 * for use of this software module or modifications thereof. No license
032 * or right to this software module is granted for non JPEG 2000 Standard
033 * conforming products. JJ2000 Partners have full right to use this
034 * software module for his/her own purpose, assign or donate this
035 * software module to any third party and to inhibit third parties from
036 * using this software module for non JPEG 2000 Standard conforming
037 * products. This copyright notice must be included in all copies or
038 * derivative works of this software module.
039 *
040 * Copyright (c) 1999/2000 JJ2000 Partners.
041 * */
042package jj2000.j2k.codestream;
043
044/**
045 * This interface defines the values of the different markers in the JPEG 2000
046 * codestream. They are 16 bit values, always appearing in big-endian (most
047 * significant byte first) and byte-aligned in the codestream. This interface
048 * also defines some other constants such as bit-masks and bit-shifts.
049 * */
050public interface Markers {
051
052    // ----> Delimiting markers and marker segments <----
053
054    /** Start of codestream (SOC): 0xFF4F */
055    public final static short SOC = (short)0xff4f;
056
057    /** Start of tile-part (SOT): 0xFF90 */
058    public final static short SOT = (short)0xff90;
059
060    /** Start of data (SOD): 0xFF93 */
061    public final static short SOD = (short)0xff93;
062
063    /** End of codestream (EOC): 0xFFD9 */
064    public final static short EOC = (short)0xffd9;
065
066    // ----> Fixed information marker segments <----
067
068    // ** SIZ marker **
069
070    /** SIZ marker (Image and tile size): 0xFF51 */
071    public final static short SIZ = (short)0xff51;
072
073    /** No special capabilities (baseline) in codestream, in Rsiz field of SIZ
074     * marker: 0x00. All flag bits are turned off */
075    public final static int RSIZ_BASELINE = 0x00;
076    /** Error resilience marker flag bit in Rsiz field in SIZ marker: 0x01 */
077    public final static int RSIZ_ER_FLAG = 0x01;
078    /** ROI present marker flag bit in Rsiz field in SIZ marker: 0x02 */
079    public final static int RSIZ_ROI = 0x02;
080    /** Component bitdepth bits in Ssiz field in SIZ marker: 7 */
081    public final static int SSIZ_DEPTH_BITS = 7;
082    /** The maximum number of component bitdepth */
083    public static final int MAX_COMP_BITDEPTH = 38;
084
085
086    // ----> Functional marker segments <----
087
088    // ** COD/COC marker **
089
090    /** Coding style default (COD): 0xFF52 */
091    public final static short COD = (short)0xff52;
092
093    /** Coding style component (COC): 0xFF53 */
094    public final static short COC = (short)0xff53;
095
096    /** Precinct used flag */
097    public final static int SCOX_PRECINCT_PARTITION = 1;
098    /** Use start of packet marker */
099    public final static int SCOX_USE_SOP = 2;
100    /** Use end of packet header marker */
101    public final static int SCOX_USE_EPH = 4;
102    /** Horizontal code-block partition origin is at x=1 */
103    public final static int SCOX_HOR_CB_PART = 8;
104    /** Vertical code-block partition origin is at y=1 */
105    public final static int SCOX_VER_CB_PART = 16;
106    /** The default size exponent of the precincts */
107    public final static int PRECINCT_PARTITION_DEF_SIZE = 0xffff;
108
109    // ** RGN marker segment **
110    /** Region-of-interest (RGN): 0xFF5E */
111    public final static short RGN = (short)0xff5e;
112
113    /** Implicit (i.e. max-shift) ROI flag for Srgn field in RGN marker
114        segment: 0x00 */
115    public final static int SRGN_IMPLICIT = 0x00;
116
117    // ** QCD/QCC markers **
118
119    /** Quantization default (QCD): 0xFF5C */
120    public final static short QCD = (short)0xff5c;
121
122    /** Quantization component (QCC): 0xFF5D */
123    public final static short QCC = (short)0xff5d;
124
125    /** Guard bits shift in SQCX field: 5 */
126    public final static int SQCX_GB_SHIFT = 5;
127    /** Guard bits mask in SQCX field: 7 */
128    public final static int SQCX_GB_MSK = 7;
129    /** No quantization (i.e. embedded reversible) flag for Sqcd or Sqcc
130     * (Sqcx) fields: 0x00. */
131    public final static int SQCX_NO_QUANTIZATION = 0x00;
132    /** Scalar derived (i.e. LL values only) quantization flag for Sqcd or
133     * Sqcc (Sqcx) fields: 0x01. */
134    public final static int SQCX_SCALAR_DERIVED = 0x01;
135    /** Scalar expounded (i.e. all values) quantization flag for Sqcd or Sqcc
136     * (Sqcx) fields: 0x02. */
137    public final static int SQCX_SCALAR_EXPOUNDED = 0x02;
138    /** Exponent shift in SPQCX when no quantization: 3 */
139    public final static int SQCX_EXP_SHIFT = 3;
140    /** Exponent bitmask in SPQCX when no quantization: 3 */
141    public final static int SQCX_EXP_MASK = (1<<5)-1;
142    /** The "SOP marker segments used" flag within Sers: 1 */
143    public final static int ERS_SOP = 1;
144    /** The "segmentation symbols used" flag within Sers: 2 */
145    public final static int ERS_SEG_SYMBOLS = 2;
146
147    // ** Progression order change **
148    public final static short POC = (short)0xff5f;
149
150    // ----> Pointer marker segments <----
151
152    /** Tile-part lengths (TLM): 0xFF55 */
153    public final static short TLM = (short)0xff55;
154
155    /** Packet length, main header (PLM): 0xFF57 */
156    public final static short PLM = (short)0xff57;
157
158    /** Packet length, tile-part header (PLT): 0xFF58 */
159    public final static short PLT = (short)0xff58;
160
161    /** Packed packet headers, main header (PPM): 0xFF60 */
162    public final static short PPM = (short)0xff60;
163
164    /** Packed packet headers, tile-part header (PPT): 0xFF61 */
165    public final static short PPT = (short)0xff61;
166
167    /** Maximum length of PPT marker segment */
168    public final static int MAX_LPPT = 65535;
169
170    /** Maximum length of PPM marker segment */
171    public final static int MAX_LPPM = 65535;
172
173
174    // ----> In bit stream markers and marker segments <----
175
176    /** Start pf packet (SOP): 0xFF91 */
177    public final static short SOP = (short)0xff91;
178
179    /** Length of SOP marker (in bytes) */
180    public final static short SOP_LENGTH = 6;
181
182    /** End of packet header (EPH): 0xFF92 */
183    public final static short EPH = (short)0xff92;
184
185    /** Length of EPH marker (in bytes) */
186    public final static short EPH_LENGTH = 2;
187
188    // ----> Informational marker segments <----
189
190    /** Component registration (CRG): 0xFF63 */
191    public final static short CRG = (short)0xff63;
192
193    /** Comment (COM): 0xFF64 */
194    public final static short COM = (short)0xff64;
195
196    /** General use registration value (COM): 0x0001 */
197    public final static short RCOM_GEN_USE = (short)0x0001;
198}