C# Class CSJ2K.Color.ColorSpaceMapper

This is the base class for all modules in the colorspace and icc profiling steps of the decoding chain. It is responsible for the allocation and iniitialization of all working storage. It provides several utilities which are of generic use in preparing DataBlks for use and provides default implementations for the getCompData and getInternCompData methods.
Inheritance: CSJ2K.j2k.image.ImgDataAdapter, BlkImgDataSrc
Show file Open project: cureos/csj2k Class Usage Examples

Protected Properties

Property Type Description
computed ComputedComponents
csMap ColorSpace
dataFloat float[][]
dataInt int[][]
eol System.String
fixedPtBitsArray int[]
inFloat CSJ2K.j2k.image.DataBlkFloat[]
inInt CSJ2K.j2k.image.DataBlkInt[]
maxValueArray int[]
ncomps int
pl CSJ2K.j2k.util.ParameterList
shiftValueArray int[]
src BlkImgDataSrc
srcBlk CSJ2K.j2k.image.DataBlk[]
workDataFloat float[][]
workDataInt int[][]
workFloat DataBlkFloat[]
workInt DataBlkInt[]

Public Methods

Method Description
close ( ) : void

Closes the underlying file or network connection from where the image data is being read.

createInstance ( BlkImgDataSrc src, ColorSpace csMap ) : BlkImgDataSrc

Factory method for creating instances of this class.

getCompData ( CSJ2K.j2k.image.DataBlk out_Renamed, int c ) : CSJ2K.j2k.image.DataBlk

Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component. The data is returned, as a copy of the internal data, therefore the returned data can be modified "in place".

The rectangular area to return is specified by the 'ulx', 'uly', 'w' and 'h' members of the 'blk' argument, relative to the current tile. These members are not modified by this method. The 'offset' of the returned data is 0, and the 'scanw' is the same as the block's width. See the 'DataBlk' class.

This method, in general, is less efficient than the 'getInternCompData()' method since, in general, it copies the data. However if the array of returned data is to be modified by the caller then this method is preferable.

If the data array in 'blk' is 'null', then a new one is created. If the data array is not 'null' then it is reused, and it must be large enough to contain the block's data. Otherwise an 'ArrayStoreException' or an 'IndexOutOfBoundsException' is thrown by the Java system.

The returned data may have its 'progressive' attribute set. In this case the returned data is only an approximation of the "final" data.

getFixedPoint ( int c ) : int

Returns the number of bits, referred to as the "range bits", corresponding to the nominal range of the data in the specified component. If this number is b then for unsigned data the nominal range is between 0 and 2^b-1, and for signed data it is between -2^(b-1) and 2^(b-1)-1. For floating point data this value is not applicable.

getInternCompData ( CSJ2K.j2k.image.DataBlk out_Renamed, int c ) : CSJ2K.j2k.image.DataBlk

Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component. The data is returned, as a reference to the internal data, if any, instead of as a copy, therefore the returned data should not be modified.

The rectangular area to return is specified by the 'ulx', 'uly', 'w' and 'h' members of the 'blk' argument, relative to the current tile. These members are not modified by this method. The 'offset' and 'scanw' of the returned data can be arbitrary. See the 'DataBlk' class.

This method, in general, is more efficient than the 'getCompData()' method since it may not copy the data. However if the array of returned data is to be modified by the caller then the other method is probably preferable.

If possible, the data in the returned 'DataBlk' should be the internal data itself, instead of a copy, in order to increase the data transfer efficiency. However, this depends on the particular implementation (it may be more convenient to just return a copy of the data). This is the reason why the returned data should not be modified.

If the data array in blk is null, then a new one is created if necessary. The implementation of this interface may choose to return the same array or a new one, depending on what is more efficient. Therefore, the data array in blk prior to the method call should not be considered to contain the returned data, a new array may have been created. Instead, get the array from blk after the method has returned.

The returned data may have its 'progressive' attribute set. In this case the returned data is only an approximation of the "final" data.

isOrigSigned ( int c ) : bool

Returns true if the data read was originally signed in the specified component, false if not.

Protected Methods

Method Description
ColorSpaceMapper ( BlkImgDataSrc src, ColorSpace csMap ) : System

Ctor which creates an ICCProfile for the image and initializes all data objects (input, working, and output).

copyGeometry ( CSJ2K.j2k.image.DataBlk tgt, CSJ2K.j2k.image.DataBlk src ) : void

Copy the DataBlk geometry from source to target DataBlk and assure that the target has an appropriate data buffer.

Private Methods

Method Description
InitBlock ( ) : void
initialize ( ) : void

General utility used by ctors

Method Details

ColorSpaceMapper() protected method

Ctor which creates an ICCProfile for the image and initializes all data objects (input, working, and output).
protected ColorSpaceMapper ( BlkImgDataSrc src, ColorSpace csMap ) : System
src BlkImgDataSrc -- Source of image data ///
csMap ColorSpace
return System

close() public method

Closes the underlying file or network connection from where the image data is being read.
If an I/O error occurs. ///
public close ( ) : void
return void

copyGeometry() protected static method

Copy the DataBlk geometry from source to target DataBlk and assure that the target has an appropriate data buffer.
protected static copyGeometry ( CSJ2K.j2k.image.DataBlk tgt, CSJ2K.j2k.image.DataBlk src ) : void
tgt CSJ2K.j2k.image.DataBlk has its geometry set. ///
src CSJ2K.j2k.image.DataBlk used to get the new geometric parameters. ///
return void

createInstance() public static method

Factory method for creating instances of this class.
profile access exception ///
public static createInstance ( BlkImgDataSrc src, ColorSpace csMap ) : BlkImgDataSrc
src BlkImgDataSrc -- source of image data ///
csMap ColorSpace -- provides colorspace info ///
return BlkImgDataSrc

getCompData() public method

Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component. The data is returned, as a copy of the internal data, therefore the returned data can be modified "in place".

The rectangular area to return is specified by the 'ulx', 'uly', 'w' and 'h' members of the 'blk' argument, relative to the current tile. These members are not modified by this method. The 'offset' of the returned data is 0, and the 'scanw' is the same as the block's width. See the 'DataBlk' class.

This method, in general, is less efficient than the 'getInternCompData()' method since, in general, it copies the data. However if the array of returned data is to be modified by the caller then this method is preferable.

If the data array in 'blk' is 'null', then a new one is created. If the data array is not 'null' then it is reused, and it must be large enough to contain the block's data. Otherwise an 'ArrayStoreException' or an 'IndexOutOfBoundsException' is thrown by the Java system.

The returned data may have its 'progressive' attribute set. In this case the returned data is only an approximation of the "final" data.

public getCompData ( CSJ2K.j2k.image.DataBlk out_Renamed, int c ) : CSJ2K.j2k.image.DataBlk
out_Renamed CSJ2K.j2k.image.DataBlk
c int The index of the component from which to get the data. /// ///
return CSJ2K.j2k.image.DataBlk

getFixedPoint() public method

Returns the number of bits, referred to as the "range bits", corresponding to the nominal range of the data in the specified component. If this number is b then for unsigned data the nominal range is between 0 and 2^b-1, and for signed data it is between -2^(b-1) and 2^(b-1)-1. For floating point data this value is not applicable.
public getFixedPoint ( int c ) : int
c int The index of the component. /// ///
return int

getInternCompData() public method

Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component. The data is returned, as a reference to the internal data, if any, instead of as a copy, therefore the returned data should not be modified.

The rectangular area to return is specified by the 'ulx', 'uly', 'w' and 'h' members of the 'blk' argument, relative to the current tile. These members are not modified by this method. The 'offset' and 'scanw' of the returned data can be arbitrary. See the 'DataBlk' class.

This method, in general, is more efficient than the 'getCompData()' method since it may not copy the data. However if the array of returned data is to be modified by the caller then the other method is probably preferable.

If possible, the data in the returned 'DataBlk' should be the internal data itself, instead of a copy, in order to increase the data transfer efficiency. However, this depends on the particular implementation (it may be more convenient to just return a copy of the data). This is the reason why the returned data should not be modified.

If the data array in blk is null, then a new one is created if necessary. The implementation of this interface may choose to return the same array or a new one, depending on what is more efficient. Therefore, the data array in blk prior to the method call should not be considered to contain the returned data, a new array may have been created. Instead, get the array from blk after the method has returned.

The returned data may have its 'progressive' attribute set. In this case the returned data is only an approximation of the "final" data.

public getInternCompData ( CSJ2K.j2k.image.DataBlk out_Renamed, int c ) : CSJ2K.j2k.image.DataBlk
out_Renamed CSJ2K.j2k.image.DataBlk
c int The index of the component from which to get the data. /// ///
return CSJ2K.j2k.image.DataBlk

isOrigSigned() public method

Returns true if the data read was originally signed in the specified component, false if not.
public isOrigSigned ( int c ) : bool
c int The index of the component, from 0 to C-1. /// ///
return bool

Property Details

computed protected property

protected ComputedComponents computed
return ComputedComponents

csMap protected property

ColorSpace info
protected ColorSpace,CSJ2K.Color csMap
return ColorSpace

dataFloat protected property

protected float[][] dataFloat
return float[][]

dataInt protected property

protected int[][] dataInt
return int[][]

eol protected static property

Platform dependant end of line String.
protected static String,System eol
return System.String

fixedPtBitsArray protected property

protected int[] fixedPtBitsArray
return int[]

inFloat protected property

protected DataBlkFloat[],CSJ2K.j2k.image inFloat
return CSJ2K.j2k.image.DataBlkFloat[]

inInt protected property

protected DataBlkInt[],CSJ2K.j2k.image inInt
return CSJ2K.j2k.image.DataBlkInt[]

maxValueArray protected property

protected int[] maxValueArray
return int[]

ncomps protected property

Number of image components
protected int ncomps
return int

pl protected property

Parameter Specs
protected ParameterList,CSJ2K.j2k.util pl
return CSJ2K.j2k.util.ParameterList

shiftValueArray protected property

protected int[] shiftValueArray
return int[]

src protected property

The image source.
protected BlkImgDataSrc src
return BlkImgDataSrc

srcBlk protected property

The image source data per component.
protected DataBlk[],CSJ2K.j2k.image srcBlk
return CSJ2K.j2k.image.DataBlk[]

workDataFloat protected property

protected float[][] workDataFloat
return float[][]

workDataInt protected property

protected int[][] workDataInt
return int[][]

workFloat protected property

protected DataBlkFloat[] workFloat
return DataBlkFloat[]

workInt protected property

protected DataBlkInt[] workInt
return DataBlkInt[]