Java Doc for MQDecoder.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » jj2000 » j2k » entropy » decoder » 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.entropy.decoder 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   jj2000.j2k.entropy.decoder.MQDecoder

MQDecoder
public class MQDecoder (Code)
This class implements the MQ arithmetic decoder. It is implemented using the software conventions decoder for better performance (i.e. execution time performance). The initial states for each context of the MQ-coder are specified in the constructor.


Field Summary
 int[]I
    
 inta
    
 intb
    
 intc
    
 intcT
    
 ByteInputBufferin
     The ByteInputBuffer used to read the compressed bit stream.
final  intinitStates
    
 int[]mPS
    
 booleanmarkerFound
    
final static  intnLPS
    
final static  intnMPS
    
final static  intqe
    
final static  intswitchLM
    

Constructor Summary
public  MQDecoder(ByteInputBuffer iStream, int nrOfContexts, int initStates)
     Instantiates a new MQ-decoder, with the specified number of contexts and initial states.

Method Summary
public  booleancheckPredTerm()
     Checks for past errors in the decoding process using the predictable error resilient termination.
final public  intdecodeSymbol(int context)
     Arithmetically decodes one symbol from the bit stream with the given context and returns its decoded value.

Each context has a current MPS and an index describing what the current probability is for the LPS.

final public  voiddecodeSymbols(int[] bits, int[] cX, int n)
     This function performs the arithmetic decoding.
final public  booleanfastDecodeSymbols(int[] bits, int ctxt, int n)
     Decodes 'n' symbols from the bit stream using the same context 'ctxt'.
public  ByteInputBuffergetByteInputBuffer()
     Returns the underlying 'ByteInputBuffer' from where the MQ coded input bytes are read.
final public  intgetNumCtxts()
     Returns the number of contexts in the arithmetic coder.
final public  voidnextSegment(byte buf, int off, int len)
     Resets the MQ decoder to start a new segment.
final public  voidresetCtxt(int c)
     Resets a context to the original probability distribution.
final public  voidresetCtxts()
     Resets a context to the original probability distribution.

Field Detail
I
int[] I(Code)
The current index of each context



a
int a(Code)
The current interval



b
int b(Code)
The last byte read



c
int c(Code)
The current bit code



cT
int cT(Code)
The bit code counter



in
ByteInputBuffer in(Code)
The ByteInputBuffer used to read the compressed bit stream.



initStates
final int initStates(Code)
The initial state of each context



mPS
int[] mPS(Code)
The current most probable signal for each context



markerFound
boolean markerFound(Code)
Flag indicating if a marker has been found



nLPS
final static int nLPS(Code)
The indexes of the next LPS



nMPS
final static int nMPS(Code)
The indexes of the next MPS



qe
final static int qe(Code)
The data structures containing the probabilities for the LPS



switchLM
final static int switchLM(Code)
Whether LPS and MPS should be switched




Constructor Detail
MQDecoder
public MQDecoder(ByteInputBuffer iStream, int nrOfContexts, int initStates)(Code)
Instantiates a new MQ-decoder, with the specified number of contexts and initial states. The compressed bytestream is read from the 'iStream' object.
Parameters:
  iStream - the stream that contains the coded bits
Parameters:
  nrOfContexts - The number of contexts used
Parameters:
  initStates - The initial state for each context. A reference iskept to this array to reinitialize the contexts whenever 'reset()' or'resetCtxts()' is called.




Method Detail
checkPredTerm
public boolean checkPredTerm()(Code)
Checks for past errors in the decoding process using the predictable error resilient termination. This works only if the encoder used the predictable error resilient MQ termination, otherwise it reports wrong results. If an error is detected it means that the MQ bit stream has been wrongly decoded or that the MQ terminated segment length is too long. If no errors are detected it does not necessarily mean that the MQ bit stream has been correctly decoded. True if errors are found, false otherwise.



decodeSymbol
final public int decodeSymbol(int context)(Code)
Arithmetically decodes one symbol from the bit stream with the given context and returns its decoded value.

Each context has a current MPS and an index describing what the current probability is for the LPS. Each bit is encoded and if the probability of the LPS exceeds .5, the MPS and LPS are switched.
Parameters:
  context - The context to use in decoding the symbol The decoded symbol, 0 or 1.




decodeSymbols
final public void decodeSymbols(int[] bits, int[] cX, int n)(Code)
This function performs the arithmetic decoding. The function receives an array in which to put the decoded symbols and an array of contexts with which to decode them.

Each context has a current MPS and an index describing what the current probability is for the LPS. Each bit is decoded and if the probability of the LPS exceeds .5, the MPS and LPS are switched.
Parameters:
  bits - The array where to place the decoded symbols. It should belong enough to contain 'n' elements.
Parameters:
  cX - The context to use in decoding each symbol.
Parameters:
  n - The number of symbols to decode




fastDecodeSymbols
final public boolean fastDecodeSymbols(int[] bits, int ctxt, int n)(Code)
Decodes 'n' symbols from the bit stream using the same context 'ctxt'. If possible the MQ-coder speedup mode will be used to speed up decoding. The speedup mode is used if Q (the LPS probability for 'ctxt' is low enough) and the A and C registers permit decoding several MPS symbols without renormalization.

Speedup mode should be used when decoding long runs of MPS with high probability with the same context.

This methiod will return the decoded symbols differently if speedup mode was used or not. If true is returned, then speedup mode was used and the 'n' decoded symbols are all the same and it is returned ain bits[0] only. If false is returned then speedup mode was not used, the decoded symbols are probably not all the same and they are returned in bits[0], bits[1], ... bits[n-1].
Parameters:
  bits - The array where to put the decoded symbols. Must be oflength 'n' or more.
Parameters:
  ctxt - The context to use in decoding the symbols.
Parameters:
  n - The number of symbols to decode. True if speedup mode was used, false if not. If speedup modewas used then all the decoded symbols are the same and its value isreturned in 'bits[0]' only (not in bits[1], bits[2], etc.).




getByteInputBuffer
public ByteInputBuffer getByteInputBuffer()(Code)
Returns the underlying 'ByteInputBuffer' from where the MQ coded input bytes are read. The underlying ByteInputBuffer.



getNumCtxts
final public int getNumCtxts()(Code)
Returns the number of contexts in the arithmetic coder. The number of contexts



nextSegment
final public void nextSegment(byte buf, int off, int len)(Code)
Resets the MQ decoder to start a new segment. This is like recreating a new MQDecoder object with new input data.
Parameters:
  buf - The byte array containing the MQ encoded data. If null thecurrent byte array is assumed.
Parameters:
  off - The index of the first element in 'buf' to be decoded. Ifnegative the byte just after the previous segment is assumed, onlyvalid if 'buf' is null.
Parameters:
  len - The number of bytes in 'buf' to be decoded. Any subsequentbytes are taken to be 0xFF.



resetCtxt
final public void resetCtxt(int c)(Code)
Resets a context to the original probability distribution.
Parameters:
  c - The number of the context (it starts at 0).



resetCtxts
final public void resetCtxts()(Code)
Resets a context to the original probability distribution. The original probability distribution depends on the actual implementation of the arithmetic coder or decoder.
Parameters:
  c - The index of the context (it starts at 0).



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.