jj2000.j2k.entropy.encoder
Class StdEntropyCoder.Compressor

java.lang.Object
  |
  +--jj2000.j2k.entropy.encoder.StdEntropyCoder.Compressor
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
StdEntropyCoder

private class StdEntropyCoder.Compressor
extends java.lang.Object
implements java.lang.Runnable

Class that takes care of running the 'compressCodeBlock()' method with thread local arguments. Used only in multithreaded implementation.


Field Summary
(package private)  int c
          The component on which to compress
(package private)  CBlkRateDistStats ccb
          The object where to store the compressed code-block
private  int idx
          The index of this compressor.
(package private)  int lcType
          The length calculation type to use in compression
(package private)  int options
          The options bitmask to use in compression
(package private)  boolean rev
          The reversible flag to use in compression
private  long[] time
          The cumulative wall time for this compressor, for each component.
(package private)  int tType
          The MQ termination type to use in compression
 
Constructor Summary
(package private) StdEntropyCoder.Compressor(int idx)
          Creates a new compressor object with the given index.
 
Method Summary
 int getIdx()
          Returns the index of this compressor.
(package private)  long getTiming(int c)
          Returns the wall time spent by this compressor for component 'c' since the last call to this method (or the creation of this compressor if not yet called).
 void run()
          Calls the 'compressCodeBlock()' method with thread local arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idx

private final int idx
The index of this compressor. Used to access thread local variables


ccb

CBlkRateDistStats ccb
The object where to store the compressed code-block


c

int c
The component on which to compress


options

int options
The options bitmask to use in compression


rev

boolean rev
The reversible flag to use in compression


lcType

int lcType
The length calculation type to use in compression


tType

int tType
The MQ termination type to use in compression


time

private long[] time
The cumulative wall time for this compressor, for each component.

Constructor Detail

StdEntropyCoder.Compressor

StdEntropyCoder.Compressor(int idx)
Creates a new compressor object with the given index.

Parameters:
idx - The index of this compressor.
Method Detail

run

public void run()
Calls the 'compressCodeBlock()' method with thread local arguments. Once completed it adds itself to the 'completedComps[c]' stack, where 'c' is the component for which this compressor is running. This last step occurs even if exceptions are thrown by the 'compressCodeBlock()' method.

Specified by:
run in interface java.lang.Runnable

getTiming

long getTiming(int c)
Returns the wall time spent by this compressor for component 'c' since the last call to this method (or the creation of this compressor if not yet called). If DO_TIMING is false 0 is returned.

Returns:
The wall time in milliseconds spent by this compressor since the last call to this method.

getIdx

public int getIdx()
Returns the index of this compressor.

Returns:
The index of this compressor.