|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCADI.Server.LogicalTarget.JPEG2000.RateDistortion.CPIBasedDelivery
public class CPIBasedDelivery
This class implements a Coding Passes Interleaving (CPI) -based rate-distortion method. The CPI method has been modified so that when a there is a reference to a coding pass, it means a real coding pass for a specific code-block and it is not a coding pass of the whole image.
Four CPI approaches have been developed:
deliverOnePacketPerPrecinct() method.
deliverOnePacketPerBitPlane() method.
deliverOnePacketPerCodingPass() method.
#getResponseScale() method.
Usage example:
construct
runResponseParameters
getResponseViewWindow
getQuality
runResponseData
getJPIPMessageData
getEORReasonCode
| Field Summary | |
|---|---|
private int[][][][][][][] |
codingPassesToSendLengths
Length of the coding passes which are included in the requested WOI. |
private CODParameters |
codParameters
Definition in CODParameters |
private int[][] |
comps
|
private int |
cpiType
Indicates which type of CPI will be used to deliver images. |
private int |
EORReasonCode
Definition in ServerLogicalTargetManager.EORReasonCode. |
private int[] |
fsiz
Some internal attributes for passing values between diferents methods. |
private HTTPResponseSender |
httpResponseSender
Definition in Worker.httpResponseSender |
private JPCParameters |
jpcParameters
Definition in JP2LogicalTarget.jpcParameters |
private JPIPMessageEncoder |
jpipMessageEncoder
Definition in JP2LogicalTargetManager. |
private java.util.ArrayList<JPIPMessageHeader> |
jpipMessageHeaders
Definition in ServerLogicalTargetManager.jpipMessageHeaders. |
private int |
layers
|
private JP2LogicalTarget |
logicalTarget
Definition in ServerLogicalTargetManager.EORReasonCode. |
private byte[] |
mainHeader
Contains the encoded main header. |
private long |
maximumResponseLength
Definition in DataLimitField.len |
private int |
maxNumLayers
Definition in CODParameters.numLayers |
private int |
MSBPlane
Definition in JP2LogicalTarget.MSBPlane |
private static int |
PACKET_PER_BIT_PLANE
This CPI tye delivery the image's window of interest by bit planes. |
private static int |
PACKET_PER_CODING_PASS
This CPI type delivery the image's window of interest building a layer for each coding pass. |
private static int |
PACKET_PER_PRECINCT
This CPI tye delivery the image's window of interest building only one packet, i.e., all coding passes of a precinct are grouped in one packet. |
private int[][][] |
precinctInLayer
Indicates the layer in which one the precinct will be included. |
private int |
quality
Definition in ServerLogicalTargetManager.quality. |
private long |
responseLength
It is a temporal attribute to accumulate the response length which is sending to the client. |
private ViewWindowField |
responseViewWindow
Definition in ServerLogicalTargetManager.responseViewWindow. |
private int[] |
roff
|
private int[] |
rsiz
|
private static int |
SCALE
This CPI type delivery the image's window of interest following the SCALE method: l = L - 1 - ((c div 3) * 2)- ((c mod 3) div 2) where: L = (K * 2) - 1 K = number of bit-planes It can be uses when the request belongs to a session or with stateless request. |
private JPCServerCache |
serverCache
This attribute contains the cache data for the client. |
private SIZParameters |
sizParameters
Definition in SIZParameters |
| Constructor Summary | |
|---|---|
CPIBasedDelivery(JP2LogicalTarget logicalTarget,
JPCServerCache serverCache,
long maximumResponseLength)
Constructor. |
|
| Method Summary | |
|---|---|
private void |
deliverOnePacketPerBitPlane()
This method is used to deliver the requested window of interes using only one packet per bit-plane. |
private void |
deliverOnePacketPerCodingPass()
This method is used to deliver the requested window of interes using only one packet per coding pass. |
private void |
deliverOnePacketPerPrecinct()
This method is used to deliver the requested window of interes using only one packet per precinct. |
private void |
deliverScale()
This method is used to delivery the requested window of interes using SCALE method. |
private void |
encodeMainHeader()
Gets the main header as a byte array. |
int |
getEORReasonCode()
Returns the EORReasonCode attribute. |
java.util.ArrayList<JPIPMessageHeader> |
getJPIPMessageHeaders()
Returns the jpipMessageHeaders attribute. |
private int |
getLayer(int codingLevel)
|
byte[] |
getMainHeader()
Returns the main header. |
private int |
getMaxSubbandWeight()
Deprecated. |
private int |
getNextCodingLevel(int codingLevel)
|
private byte[] |
getPacketHeaderOnePacketPerBitPlane(PacketHeadersEncoder packetHeading,
long inClassIdentifier,
int z,
int rLevel,
int virtualBitPlane,
int totalNumVirtualBitPlanes,
int[][][][] codingPassesLengths)
Builds a packet header using one packet per bit plane It is an auxiliary method used by #getResponseOnePacketPerBitPlane()
method to build the packet headers. |
private byte[] |
getPacketHeaderOnePacketPerCodingPass(PacketHeadersEncoder packetHeadersEncoder,
long inClassIdentifier,
int z,
int rLevel,
int codingLevel,
int[][][][] codingPassesLengths)
Builds a packet header for a specific coding level. |
private byte[] |
getPacketHeaderScale(PacketHeadersEncoder packetHeading,
long inClassIdentifier,
int z,
int rLevel,
int totalNumVirtualCodingLevels,
int virtualCodingLevel,
int[][][][] codingPassesLengths)
Builds a packet header for a specific coding level. |
int |
getQuality()
Returns the quality attribute. |
ViewWindowField |
getResponseViewWindow()
Returns the responseViewWindow attribute. |
private int |
getSubbandWeight(int z,
int rLevel,
int subband)
Deprecated. |
private boolean |
isMRP(int codingLevel)
Check whether a coding level is or not a MRP pass. |
void |
list(java.io.PrintStream out)
Prints this CPI delivery out to the specified output stream. |
private static void |
printByteArray(byte[] buffer)
Useful method for printing a byte array. |
private void |
printTypeOfCodingPass(int codingLevel)
Useful to print which is the type of each coding level. |
void |
runResponseData(HTTPResponseSender httpResponseSender,
JPIPMessageEncoder jpipMessageEncoder,
java.util.ArrayList<JPIPMessageHeader> jpipMessageHeaders)
Gets the data of the response window of interes. |
void |
runResponseParameters(ViewWindowField viewWindow)
|
void |
setCPIType(int cpiType)
Set the subtype of the CPI. |
private void |
setFirstLayerOnePacketPerBitPlane(PacketHeadersEncoder packetHeading,
long inClassIdentifier,
int z,
int rLevel,
int[][][][] codingPassesLengths)
This method adjusts the first layer when requested window of interest is delivered using one packet per bit plane. |
private void |
setFirstLayerScale(PacketHeadersEncoder packetHeading,
long inClassIdentifier,
int z,
int rLevel,
int[][][][] codingPassesLengths)
This method adjusts the first layer when requested window of interest is delivered using the SCALE method. |
private boolean |
skipPrecinctScale(long inClassIdentifier,
int z,
int rLevel,
int totalNumVirtualCodingLevels,
int virtualCodingLevel,
int[][][][] codingPassesLengths)
Check if a precinct has to be, or not, included in a fixed coding level. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private HTTPResponseSender httpResponseSender
Worker.httpResponseSender
private JPIPMessageEncoder jpipMessageEncoder
JP2LogicalTargetManager.
private java.util.ArrayList<JPIPMessageHeader> jpipMessageHeaders
ServerLogicalTargetManager.jpipMessageHeaders.
private byte[] mainHeader
private ViewWindowField responseViewWindow
ServerLogicalTargetManager.responseViewWindow.
private int quality
ServerLogicalTargetManager.quality.
private int EORReasonCode
ServerLogicalTargetManager.EORReasonCode.
private JP2LogicalTarget logicalTarget
ServerLogicalTargetManager.EORReasonCode.
private JPCServerCache serverCache
This reference is passed from the
private long maximumResponseLength
DataLimitField.len
private int cpiType
Allowed values:
private long responseLength
private JPCParameters jpcParameters
JP2LogicalTarget.jpcParameters
private SIZParameters sizParameters
SIZParameters
private CODParameters codParameters
CODParameters
private int MSBPlane
JP2LogicalTarget.MSBPlane
private int maxNumLayers
CODParameters.numLayers
private int[] fsiz
ViewWindowField
private int[] roff
private int[] rsiz
private int[][] comps
private int layers
private int[][][][][][][] codingPassesToSendLengths
It is used to pass information between the methods that calculate the WOI
using the CPI rate-distortion approach.
Indices means:
z: image component
resolutionLevel: 0 is the LL subband, and 1, 2, ... represents next
starting with the little one
precinct: precinct in the resolution level
subband: 0 - HL, 1 - LH, 2 - HH (ifresolutionLevel == 0 --> 0 -
LL)
yBlock: block row in the subband
xBlock: block column in the subband
codingPass: coding passes included in this layer
See precinctInLayer
private int[][][] precinctInLayer
It is used to pass information between the methods that calculate the WOI using the CPI rate-distortion approach.
Indices means:
z: image component
resolutionLevel: 0 is the LL subband, and 1, 2, ... represents next
starting with the little one
precinct: precinct in the resolution level
See codingPassesToSendLengths
private static final int PACKET_PER_PRECINCT
It can be uses when the request belongs to a session or with stateless request.
private static final int PACKET_PER_BIT_PLANE
Builds a packet for each bit-plane. So coding passes of different bit-planes are not grouped in the same packet.
It can be uses when the request belongs to a session or with stateless request.
private static final int PACKET_PER_CODING_PASS
It is the worst approach because a packet is built for each coding pass, even when two or more coding passes of the same precinct are sent.
It can be uses when the request belongs to a session or with stateless request.
private static final int SCALE
It can be uses when the request belongs to a session or with stateless request.
| Constructor Detail |
|---|
public CPIBasedDelivery(JP2LogicalTarget logicalTarget,
JPCServerCache serverCache,
long maximumResponseLength)
logicalTarget - definition in logicalTargetserverCache - definition in serverCachemaximumResponseLength - definition in maximumResponseLength| Method Detail |
|---|
public void setCPIType(int cpiType)
cpiType - definition in cpiTypepublic void runResponseParameters(ViewWindowField viewWindow)
viewWindow - the requested Window Of Interest
public void runResponseData(HTTPResponseSender httpResponseSender,
JPIPMessageEncoder jpipMessageEncoder,
java.util.ArrayList<JPIPMessageHeader> jpipMessageHeaders)
throws ErrorException,
java.io.IOException
httpResponseSender - definition in httpResponseSenderjpipMessageEncoder - definition in jpipMessageEncoderjpipMessageHeaders - definition in jpipMessageHeaders
ErrorException
java.io.IOException
public byte[] getMainHeader()
throws ErrorException
mainHeader.
ErrorExceptionpublic int getEORReasonCode()
EORReasonCode attribute.
EORReasonCode attribute.public ViewWindowField getResponseViewWindow()
responseViewWindow attribute.
responseViewWindow attribute.public java.util.ArrayList<JPIPMessageHeader> getJPIPMessageHeaders()
jpipMessageHeaders attribute.
jpipMessageHeaders attribute.public int getQuality()
quality attribute.
quality attribute.public java.lang.String toString()
toString in class java.lang.Objectpublic void list(java.io.PrintStream out)
out - an output stream.
private void encodeMainHeader()
throws ErrorException
ErrorException
private int getSubbandWeight(int z,
int rLevel,
int subband)
z - image componentrLevel - 0 is the LL subband, and 1, 2, ... represents
next starting with the little onesubband - 0 - HL, 1 - LH, 2 - HH (if resolutionLevel == 0 --> 0 -
LL)
private int getMaxSubbandWeight()
method.
private void deliverOnePacketPerPrecinct()
throws ErrorException,
java.io.IOException
The algorithm of this rate-distortion method is the most simple. But the coding performance achieved when the image is delivered with this algorithm is not the best one.
The coding performance is improved when delivered data are weigthed
applying a weight to each subband of the tansformed image. Further
information about suband weights, see the
#getRateDistortionAdjustment(int, int, int) method.
ErrorException
java.io.IOException
private void deliverOnePacketPerCodingPass()
throws ErrorException,
java.io.IOException
This rate-distortion method is useful to delivery the image when the request does not belong to a session, so the server does not have any information about the client's cache status. In this case, a fixed image structure is needed because, sometimes, the client includes in its request (stateless) information about the status of its cache.
The algorithm of this rate-distortion method is very simple. But the coding performance achieved when the image is delivered with this algorithm is not the best one.
ErrorException
java.io.IOException
private byte[] getPacketHeaderOnePacketPerCodingPass(PacketHeadersEncoder packetHeadersEncoder,
long inClassIdentifier,
int z,
int rLevel,
int codingLevel,
int[][][][] codingPassesLengths)
throws ErrorException
It is an auxiliary method used by deliverOnePacketPerCodingPass()
method to build the packet headers.
z - the image componentrLevel - the resolution level in the componentprecinct - the precinct in the resolution levelcodingLevel - the coding levelcodingPassesLengths - a multiple array with the length of all coding
passes that belong to the same precinct.
ErrorException - if the packet header cannot be built because an
error has been found.
private void deliverOnePacketPerBitPlane()
throws ErrorException,
java.io.IOException
This rate-distortion method is useful to delivery the image when the request does not belong to a session, so the server does not have any information about the client's cache status. In this case, a fixed image structure is needed because, sometimes, the client includes in its request (stateless) information about the status of its cache.
The algorithm of this rate-distortion method is the very simple. But the coding performance achieved when the image is delivered with this algorithm is not the best one.
ErrorException
java.io.IOException
private void setFirstLayerOnePacketPerBitPlane(PacketHeadersEncoder packetHeading,
long inClassIdentifier,
int z,
int rLevel,
int[][][][] codingPassesLengths)
throws ErrorException
packetHeading - inClassIdentifier - z - rLevel - int[][][][] - codingPassesLengths
ErrorException
private byte[] getPacketHeaderOnePacketPerBitPlane(PacketHeadersEncoder packetHeading,
long inClassIdentifier,
int z,
int rLevel,
int virtualBitPlane,
int totalNumVirtualBitPlanes,
int[][][][] codingPassesLengths)
throws ErrorException
It is an auxiliary method used by #getResponseOnePacketPerBitPlane()
method to build the packet headers.
packetHeading - the packet heading object used to build the header.inClassIdentifier - z - the image component.rLevel - the resolution level in the component.virtualBitPlane - totalNumVirtualBitPlanes - codingPasses - a multiple array with the length of all coding
passes belonging to the precinct.
ErrorException - if the packet header cannot be built because an
error has been found.
private void deliverScale()
throws ErrorException,
java.io.IOException
This rate-distortion method is useful to delivery the image when the request does not belong to a session, so the server does not have any information about the client's cache status. In this case, a fixed image structure is needed because, sometimes, the client includes in its request (stateless) information about the status of its cache.
NOTE: Although the subband weight function is the number of coding passes to be upshifted, this value is mapped to bit planes (multipling by 3) in order to keep the coherence and allow the MRP and CP may be joined.
ErrorException
java.io.IOExceptionprivate int getNextCodingLevel(int codingLevel)
codingLevel -
private int getLayer(int codingLevel)
codingLevel -
private boolean isMRP(int codingLevel)
codingLevel -
private void setFirstLayerScale(PacketHeadersEncoder packetHeading,
long inClassIdentifier,
int z,
int rLevel,
int[][][][] codingPassesLengths)
throws ErrorException
packetHeading - inClassIdentifier - z - rLevel - codingPassesLengths -
ErrorException
private byte[] getPacketHeaderScale(PacketHeadersEncoder packetHeading,
long inClassIdentifier,
int z,
int rLevel,
int totalNumVirtualCodingLevels,
int virtualCodingLevel,
int[][][][] codingPassesLengths)
throws ErrorException
It is an auxiliary method used by #getResponseOnePacketPerCodingPass()
method to build the packet headers.
packetHeading - the packet heading object used to build the header.z - the image component.rLevel - the resolution level in the component.precinct - the precinct in the resolution levelinitialCodingPass - the first coding pass of the packet.numOfCodingPasses - the number of coding passes of the packet.codingPasses - a multiple array with the length of all coding
passes belonging to the precinct.
ErrorException - if the packet header cannot be built because an
error has been found.
private boolean skipPrecinctScale(long inClassIdentifier,
int z,
int rLevel,
int totalNumVirtualCodingLevels,
int virtualCodingLevel,
int[][][][] codingPassesLengths)
This method is only used by the deliverScale() method.
inClassIdentifier - z - rLevel - totalNumVirtualCodingLevels - virtualCodingLevel - codingPassesLengths -
private void printTypeOfCodingPass(int codingLevel)
codingLevel - private static void printByteArray(byte[] buffer)
buffer - the byte array to be printed.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||