Java Doc for HeaderDecoder.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » jj2000 » j2k » codestream » reader » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » jj2000.j2k.codestream.reader 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   jj2000.j2k.codestream.reader.HeaderDecoder

HeaderDecoder
public class HeaderDecoder implements ProgressionType,Markers,StdEntropyCoderOptions(Code)
This class reads Main and Tile-part headers from the codestream. It is created by the run() method of the Decoder instance.

A marker segment includes a marker and eventually marker segment parameters. It is designed by the three letters code of the marker associated with the marker segment. JPEG 2000 part 1 defines 6 types of markers:

  • Delimiting : SOC,SOT (read in FileBitstreamReaderAgent),SOD,EOC (read in FileBitstreamReaderAgent).
  • Fixed information: SIZ.
  • Functional: COD,COC,RGN,QCD,QCC,POC.
  • In bit-stream: SOP,EPH.
  • Pointer: TLM,PLM,PLT,PPM,PPT.
  • Informational: CRG,COM.

The main header is read when the constructor is called whereas tile-part headers are read when the FileBitstreamReaderAgent instance is created. The reading is done in 2 passes:

  • All marker segments are buffered and their corresponding flag is activated (extractMainMarkSeg and extractTilePartMarkSeg methods).
  • Buffered marker segment are analyzed in a logical way and specifications are stored in appropriate member of DecoderSpecs instance (readFoundMainMarkSeg and readFoundTilePartMarkSeg methods).

Whenever a marker segment is not recognized a warning message is displayed and its length parameter is used to skip it.
See Also:   DecoderSpecs
See Also:   Decoder
See Also:   FileBitstreamReaderAgent



Field Summary
final public static  intCRG_FOUND
    
final public static  charOPT_PREFIX
    
final public static  intPPM_FOUND
    
final public static  intPPT_FOUND
    
final public static  intSOD_FOUND
    
public  intmainHeadOff
    
public  int[]nTileParts
    
 booleanprecinctPartitionIsUsed
    
public  VectortileOfTileParts
    

Constructor Summary
public  HeaderDecoder(RandomAccessIO ehs, J2KImageReadParamJava j2krparam, HeaderInfo hi)
     Creates a HeaderDecoder instance and read in two passes the main header of the codestream.

Method Summary
public  voidcheckMarkerLength(DataInputStream ehs, String str)
     Checks that the marker segment length is correct.
final public  DequantizercreateDequantizer(CBlkQuantDataSrcDec src, int rb, DecoderSpecs decSpec2)
     Returns the dequantizer parameters.
public  EntropyDecodercreateEntropyDecoder(CodedCBlkDataSrcDec src, J2KImageReadParamJava j2krparam)
     Creates and returns the entropy decoder corresponding to the information read from the codestream header and with the special additional parameters from the parameter list.
Parameters:
  src - The bit stream reader agent where to get code-block datafrom.
Parameters:
  j2krparam - The parameter list containing parameters applicable to theentropy decoder (other parameters can also be present).
public  ROIDeScalercreateROIDeScaler(CBlkQuantDataSrcDec src, J2KImageReadParamJava j2krparam, DecoderSpecs decSpec2)
     Creates and returns the ROIDeScaler corresponding to the information read from the codestream header and with the special additional parameters from the parameter list.
Parameters:
  src - The bit stream reader agent where to get code-block datafrom.
Parameters:
  pl - The parameter list containing parameters applicable to theentropy decoder (other parameters can also be present).
public  voidextractTilePartMarkSeg(short marker, RandomAccessIO ehs, int tileIdx, int tilePartIdx)
     This method extracts a marker segment in a tile-part header and stores it into a byte buffer for the second pass.
final public  intgetCbULX()
     Returns the horizontal code-block partition origin.Allowable values are 0 and 1, nothing else.
final public  intgetCbULY()
     Returns the vertical code-block partition origin.
final public  intgetCompSubsX(int c)
     Returns the component sub-sampling factor, with respect to the reference grid, along the horizontal direction for the specified component.
final public  intgetCompSubsY(int c)
     Returns the component sub-sampling factor, with respect to the reference grid, along the vertical direction for the specified component.
public  DecoderSpecsgetDecoderSpecs()
    
final public  intgetImgHeight()
     Returns the image height in the reference grid.
final public  intgetImgULX()
     Return the horizontal upper-left coordinate of the image in the reference grid.
final public  intgetImgULY()
     Return the vertical upper-left coordinate of the image in the reference grid.
final public  intgetImgWidth()
     Returns the image width in the reference grid.
public  intgetMaxCompImgHeight()
    
public  intgetMaxCompImgWidth()
    
final public  intgetNomTileHeight()
     Returns the nominal width of the tiles in the reference grid.
final public  intgetNomTileWidth()
     Returns the nominal width of the tiles in the reference grid.
final public  intgetNumComps()
     Returns the number of components in the image.
public  intgetNumFoundMarkSeg()
     Returns the number of found marker segments in the current header.
public  intgetNumTiles()
    
final public  intgetOriginalBitDepth(int c)
     Returns the original bitdepth of the specified component.
final public  intgetPPX(int t, int c, int rl)
     Returns the precinct partition width for the specified tile-component and resolution level.
final public  intgetPPY(int t, int c, int rl)
     Returns the precinct partition height for the specified component, tile and resolution level.
public  ByteArrayInputStreamgetPackedPktHead(int tile)
     Return the packed packet headers for a given tile.
public static  String[][]getParameterInfo()
     Returns the parameters that are used in this class.
final public  PointgetTilingOrigin(Point co)
     Returns the tiling origin, referred to as '(Px,Py)' in the 'ImgData' interface.
Parameters:
  co - If not null this object is used to return the information.
final public  booleanisOriginalSigned(int c)
     Returns true if the original data of the specified component was signed.
final public  booleanprecinctPartitionUsed()
    
public  voidreadFoundTilePartMarkSeg(int tileIdx, int tpIdx)
    
public  voidresetHeaderMarkers()
    
public  voidsetTileOfTileParts(int tile)
     Sets the tile of each tile part in order.
public  StringtoString()
     Print information about the current header.

Field Detail
CRG_FOUND
final public static int CRG_FOUND(Code)
Flag bit for CRG marker segment found



OPT_PREFIX
final public static char OPT_PREFIX(Code)
The prefix for header decoder options: 'H'



PPM_FOUND
final public static int PPM_FOUND(Code)
Flag bit for SOD marker segment found



PPT_FOUND
final public static int PPT_FOUND(Code)
Flag bit for SOD marker segment found



SOD_FOUND
final public static int SOD_FOUND(Code)
Flag bit for SOD marker segment found



mainHeadOff
public int mainHeadOff(Code)
The offset of the main header in the input stream



nTileParts
public int[] nTileParts(Code)
The number of tile parts per tile



precinctPartitionIsUsed
boolean precinctPartitionIsUsed(Code)
Is the precinct partition used



tileOfTileParts
public Vector tileOfTileParts(Code)
Vector containing info as to which tile each tilepart belong




Constructor Detail
HeaderDecoder
public HeaderDecoder(RandomAccessIO ehs, J2KImageReadParamJava j2krparam, HeaderInfo hi) throws IOException(Code)
Creates a HeaderDecoder instance and read in two passes the main header of the codestream. The first and last marker segments shall be respectively SOC and SOT.
Parameters:
  ehs - The encoded header stream where marker segment areextracted.
Parameters:
  j2krparam - The parameter list of the decoder
Parameters:
  hi - The HeaderInfo holding information found in marker segments
exception:
  IOException - If an I/O error occurs while reading from theencoded header stream.
exception:
  EOFException - If the end of the encoded header stream isreached before getting all the data.
exception:
  CorruptedCodestreamException - If invalid data is found in thecodestream main header.




Method Detail
checkMarkerLength
public void checkMarkerLength(DataInputStream ehs, String str) throws IOException(Code)
Checks that the marker segment length is correct.
Parameters:
  ehs - The encoded header stream
Parameters:
  str - The string identifying the marker, such as "SIZ marker"
exception:
  IOException - If an I/O error occurs



createDequantizer
final public Dequantizer createDequantizer(CBlkQuantDataSrcDec src, int rb, DecoderSpecs decSpec2)(Code)
Returns the dequantizer parameters. Dequantizer parameters normally are the quantization step sizes, see DequantizerParams.
Parameters:
  src - The source of data for the dequantizer.
Parameters:
  rb - The number of range bits for each component. Must bethe number of range bits of the mixed components.
Parameters:
  decSpec2 - The DecoderSpecs instance after any image manipulation. The dequantizer



createEntropyDecoder
public EntropyDecoder createEntropyDecoder(CodedCBlkDataSrcDec src, J2KImageReadParamJava j2krparam)(Code)
Creates and returns the entropy decoder corresponding to the information read from the codestream header and with the special additional parameters from the parameter list.
Parameters:
  src - The bit stream reader agent where to get code-block datafrom.
Parameters:
  j2krparam - The parameter list containing parameters applicable to theentropy decoder (other parameters can also be present). The entropy decoder



createROIDeScaler
public ROIDeScaler createROIDeScaler(CBlkQuantDataSrcDec src, J2KImageReadParamJava j2krparam, DecoderSpecs decSpec2)(Code)
Creates and returns the ROIDeScaler corresponding to the information read from the codestream header and with the special additional parameters from the parameter list.
Parameters:
  src - The bit stream reader agent where to get code-block datafrom.
Parameters:
  pl - The parameter list containing parameters applicable to theentropy decoder (other parameters can also be present). The ROI descaler



extractTilePartMarkSeg
public void extractTilePartMarkSeg(short marker, RandomAccessIO ehs, int tileIdx, int tilePartIdx) throws IOException(Code)
This method extracts a marker segment in a tile-part header and stores it into a byte buffer for the second pass. The marker is first recognized, then its flag is activated and, finally, its content is buffered in an element of byte arrays accessible thanks to a hashTable. If a marker segment is not recognized, it prints a warning and skip it according to its length.
Parameters:
  marker - The marker to process
Parameters:
  ehs - The encoded header stream
Parameters:
  tileIdx - The index of the current tile
Parameters:
  tilePartIdx - The index of the current tile part



getCbULX
final public int getCbULX()(Code)
Returns the horizontal code-block partition origin.Allowable values are 0 and 1, nothing else.



getCbULY
final public int getCbULY()(Code)
Returns the vertical code-block partition origin. Allowable values are 0 and 1, nothing else.



getCompSubsX
final public int getCompSubsX(int c)(Code)
Returns the component sub-sampling factor, with respect to the reference grid, along the horizontal direction for the specified component.
Parameters:
  c - The index of the component The component sub-sampling factor X-wise.



getCompSubsY
final public int getCompSubsY(int c)(Code)
Returns the component sub-sampling factor, with respect to the reference grid, along the vertical direction for the specified component.
Parameters:
  c - The index of the component The component sub-sampling factor Y-wise.



getDecoderSpecs
public DecoderSpecs getDecoderSpecs()(Code)
Return the DecoderSpecs instance filled when reading the headers The DecoderSpecs of the decoder



getImgHeight
final public int getImgHeight()(Code)
Returns the image height in the reference grid. The image height in the reference grid



getImgULX
final public int getImgULX()(Code)
Return the horizontal upper-left coordinate of the image in the reference grid. The horizontal coordinate of the image origin.



getImgULY
final public int getImgULY()(Code)
Return the vertical upper-left coordinate of the image in the reference grid. The vertical coordinate of the image origin.



getImgWidth
final public int getImgWidth()(Code)
Returns the image width in the reference grid. The image width in the reference grid



getMaxCompImgHeight
public int getMaxCompImgHeight()(Code)
Return the maximum height among all components Maximum component height



getMaxCompImgWidth
public int getMaxCompImgWidth()(Code)
Return the maximum width among all components Maximum component width



getNomTileHeight
final public int getNomTileHeight()(Code)
Returns the nominal width of the tiles in the reference grid. The nominal tile width, in the reference grid.



getNomTileWidth
final public int getNomTileWidth()(Code)
Returns the nominal width of the tiles in the reference grid. The nominal tile width, in the reference grid.



getNumComps
final public int getNumComps()(Code)
Returns the number of components in the image. The number of components in the image.



getNumFoundMarkSeg
public int getNumFoundMarkSeg()(Code)
Returns the number of found marker segments in the current header. The number of marker segments found in the current header.



getNumTiles
public int getNumTiles()(Code)
Return the number of tiles in the image The number of tiles



getOriginalBitDepth
final public int getOriginalBitDepth(int c)(Code)
Returns the original bitdepth of the specified component.
Parameters:
  c - The index of the component The bitdepth of the component



getPPX
final public int getPPX(int t, int c, int rl)(Code)
Returns the precinct partition width for the specified tile-component and resolution level.
Parameters:
  c - the component index
Parameters:
  t - the tile index
Parameters:
  rl - the resolution level The precinct partition width for the specified tile-componentand resolution level



getPPY
final public int getPPY(int t, int c, int rl)(Code)
Returns the precinct partition height for the specified component, tile and resolution level.
Parameters:
  c - the component
Parameters:
  t - the tile index
Parameters:
  rl - the resolution level The precinct partition height for the specified component,tile and resolution level



getPackedPktHead
public ByteArrayInputStream getPackedPktHead(int tile) throws IOException(Code)
Return the packed packet headers for a given tile. An input stream containing the packed packet headers for aparticular tile
exception:
  IOException - If an I/O error occurs while reading from theencoder header stream



getParameterInfo
public static String[][] getParameterInfo()(Code)
Returns the parameters that are used in this class. It returns a 2D String array. Each of the 1D arrays is for a different option, and they have 3 elements. The first element is the option name, the second one is the synopsis and the third one is a long description of what the parameter is. The synopsis or description may be 'null', in which case it is assumed that there is no synopsis or description of the option, respectively. the options name, their synopsis and their explanation.



getTilingOrigin
final public Point getTilingOrigin(Point co)(Code)
Returns the tiling origin, referred to as '(Px,Py)' in the 'ImgData' interface.
Parameters:
  co - If not null this object is used to return the information. Ifnull a new one is created and returned. The coordinate of the tiling origin, in the canvas system, onthe reference grid.
See Also:   jj2000.j2k.image.ImgData



isOriginalSigned
final public boolean isOriginalSigned(int c)(Code)
Returns true if the original data of the specified component was signed. If the data was not signed a level shift has to be applied at the end of the decompression chain.
Parameters:
  c - The index of the component True if the original image component was signed.



precinctPartitionUsed
final public boolean precinctPartitionUsed()(Code)
Returns the boolean used to know if the precinct partition is used



readFoundTilePartMarkSeg
public void readFoundTilePartMarkSeg(int tileIdx, int tpIdx) throws IOException(Code)
Return the DecoderSpecs instance filled when reading the headers
Parameters:
  tileIdx - The index of the current tile
Parameters:
  tpIdx - Index of the current tile-part



resetHeaderMarkers
public void resetHeaderMarkers()(Code)
Method that resets members indicating which markers have already been found



setTileOfTileParts
public void setTileOfTileParts(int tile)(Code)
Sets the tile of each tile part in order. This information is needed for identifying which packet header belongs to which tile when using the PPM marker.
Parameters:
  tile - The tile number that the present tile part belongs to.



toString
public String toString()(Code)
Print information about the current header. Information in a String



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.