ComponentOne PdfViewer for WPF and Silverlight
C1.WPF.PdfViewer.4.6.2 Assembly / CSJ2K.j2k.entropy.encoder Namespace / MQCoder Class
Fields Properties Methods


In This Topic
    MQCoder Class Members
    In This Topic

    The following tables list the members exposed by MQCoder.

    Public Constructors
     NameDescription
    Public ConstructorInstantiates a new MQ-coder, with the specified number of contexts and initial states. The compressed bytestream is written to the 'oStream' object.  
    Top
    Public Fields
     NameDescription
    Public FieldIdentifier for the lazy length calculation. The lazy length calculation is not optimal but is extremely simple.  
    Public FieldIdentifier for a very simple length calculation. This provides better results than the 'LENGTH_LAZY' computation. This is the old length calculation that was implemented in this class.  
    Public FieldIdentifier for the near optimal length calculation. This calculation is more complex than the lazy one but provides an almost optimal length calculation.  
    Public FieldThe identifier for the easy termination that is simpler than the 'TERM_NEAR_OPT' one but slightly less efficient.  
    Public FieldThe identifier fort the termination that uses a full flush. This is the less efficient termination.  
    Public FieldThe identifier for the termination that uses the near optimal length calculation to terminate the arithmetic codewrod  
    Public FieldThe identifier for the predictable termination policy for error resilience. This is the same as the 'TERM_EASY' one but an special sequence of bits is embodied in the spare bits for error resilience purposes.  
    Top
    Public Properties
     NameDescription
    Public PropertySet the length calculation type to the specified type.  
    Public PropertyReturns the number of bytes that are necessary from the compressed output stream to decode all the symbols that have been coded this far. The number of returned bytes does not include anything coded previous to the last time the 'terminate()' or 'reset()' methods where called.

    The values returned by this method are then to be used in finishing the length calculation with the 'finishLengthCalculation()' method, after compensation of the offset in the number of bytes due to previous terminated segments.

    This method should not be called if the current coding pass is to be terminated. The 'terminate()' method should be called instead.

    The calculation is done based on the type of length calculation specified at the constructor.

     
    Public PropertyReturns the number of contexts in the arithmetic coder.  
    Public PropertySet termination type to the specified type.  
    Top
    Public Methods
     NameDescription
    Public MethodThis function performs the arithmetic encoding of one symbol. The function receives a bit that is to be encoded and a context with which to encode it.

    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.

     
    Public MethodThis function performs the arithmetic encoding of several symbols together. The function receives an array of symbols that are to be encoded and an array containing the contexts with which to encode them.

    The advantage of using this function is that the cost of the method call is amortized by the number of coded symbols per method call.

    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.

     
    Public Method  
    Public MethodTerminates the calculation of the required length for each coding pass. This method must be called just after the 'terminate()' one has been called for each terminated MQ segment.

    The values in 'rates' must have been compensated for any offset due to previous terminated segments, so that the correct index to the stored coded data is used.

     
    Public MethodReinitializes the MQ coder and the underlying 'ByteOutputBuffer' buffer as if a new object was instantaited. All the data in the 'ByteOutputBuffer' buffer is erased and the state and contexts of the MQ coder are reinitialized). Additionally any saved MQ states are discarded.  
    Public MethodResets a context to the original probability distribution, and sets its more probable symbol to 0.  
    Public MethodResets all contexts to their original probability distribution and sets all more probable symbols to 0.  
    Public MethodThis function flushes the remaining encoded bits and makes sure that enough information is written to the bit stream to be able to finish decoding, and then it reinitializes the internal state of the MQ coder but without modifying the context states.

    After calling this method the 'finishLengthCalculation()' method should be called, after compensating the returned length for the length of previous coded segments, so that the length calculation is finalized.

    The type of termination used depends on the one specified at the constructor.

     
    Top
    See Also