public class WindowScalingFactor
extends java.lang.Object
Further information about the Window Scaling Factor, see: Taubman, D. and Rosenbaum, R., "Rate-Distortion Optimized Interactive Browsing of JPEG2000 Images" and Lima, L. and Taubman, D. and Leonardi, R., "JPIP Proxy Server for remote browsing of JPEG2000 images"
Usage example:
construct
runResponseParameters
runResponseData
getResponseViewWindow
getQuality
getJPIPMessageData
getEORReasonCode
, 1.0.6 2011/08/12
Modifier and Type | Field and Description |
---|---|
private ViewWindowField |
actualViewWindow |
protected boolean |
align
Definition in
ServerControlField.align . |
protected JPEG2KCodestream |
codestream |
private int[] |
compressionSlopeThresholds |
private int |
discardLevels |
protected int |
EORReasonCode
Definition in
CADI.Server.LogicalTarget.ServerLogicalTargetManager#EORReasonCode . |
protected JPEG2KLogicalTarget |
logicalTarget |
protected long |
maximumResponseLength
Definition in
DataLimitField.len |
private static int |
NUM_SLOPE_THRESHOLDS
Number of resequenced quality layers.
|
protected int |
quality
Definition in
CADI.Server.LogicalTarget.ServerLogicalTargetManager#quality . |
private java.util.ArrayList<RelevantPrecinct> |
relevantPrecincts |
private float[] |
resequencedSlopeThresholds |
private long |
responseLength
It is a temporal attribute to accumulate the response length which is
sending to the client.
|
protected ViewWindowField |
responseViewWindow
Definition in
CADI.Server.LogicalTarget.ServerLogicalTargetManager#responseViewWindow . |
protected PredictiveScalingFactors |
scalingFactors
Addtional window scaling factors.
|
protected CacheModel |
serverCache
This attribute contains the cache data for the client.
|
Constructor and Description |
---|
WindowScalingFactor()
Constructor.
|
WindowScalingFactor(JPEG2KLogicalTarget logicalTarget,
CacheModel serverCache,
JPEG2KCodestream codestream)
Constructor.
|
WindowScalingFactor(JPEG2KLogicalTarget logicalTarget,
CacheModel serverCache,
JPEG2KCodestream codestream,
boolean align)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static int[] |
computeCompressionSlopeThresholds(COMParameters comParameters,
int numLayers)
This method computes the compression slope thresholds used in the Window
Scaling Factor algorithm.
|
static float[] |
computeResequencedSlopeThresholds(int numSlopeThresholds) |
private void |
findRelevantPrecinctsResequencedLayers(ViewWindowField actualViewWindow)
This methods determines which precincts are relevant to the requested
Window Of Interest.
|
int |
getEORReasonCode()
Returns the
EORReasonCode attribute. |
int |
getQuality()
Returns the
quality attribute. |
ViewWindowField |
getResponseViewWindow()
Returns the
responseViewWindow attribute. |
void |
list(java.io.PrintStream out)
Prints this File Order Delivery out to the specified output stream.
|
protected void |
packetsSequencing()
This method performs the packet sequencing algorithm of the Window Scaling
Factor.
|
java.util.ArrayList<RelevantPrecinct> |
runResponseData() |
java.util.ArrayList<RelevantPrecinct> |
runResponseData(long maximumResponseLength) |
void |
runResponseParameters(ViewWindowField viewWindow)
Calculates the WOI which will be sent to the client using a layers-based
rate-distortion method (file is delivery in the same order that is is
saved).
|
void |
setAditionalScalingFactors(PredictiveScalingFactors scalingFactors)
Sets the
#aditionSF attribute. |
void |
setAlign(boolean align)
Sets the
align attribute. |
java.lang.String |
toString() |
protected ViewWindowField responseViewWindow
CADI.Server.LogicalTarget.ServerLogicalTargetManager#responseViewWindow
.protected JPEG2KLogicalTarget logicalTarget
protected PredictiveScalingFactors scalingFactors
Defines new scaling factors / weights to be applied. The key
of the HashMap is the unique precinct identifier and the value
is a real value in the range [0,1] with the weight.
protected CacheModel serverCache
This reference is passed from the
protected JPEG2KCodestream codestream
protected int quality
CADI.Server.LogicalTarget.ServerLogicalTargetManager#quality
.protected int EORReasonCode
CADI.Server.LogicalTarget.ServerLogicalTargetManager#EORReasonCode
.protected long maximumResponseLength
DataLimitField.len
protected boolean align
ServerControlField.align
.private long responseLength
private int discardLevels
private ViewWindowField actualViewWindow
private java.util.ArrayList<RelevantPrecinct> relevantPrecincts
private int[] compressionSlopeThresholds
private float[] resequencedSlopeThresholds
private static final int NUM_SLOPE_THRESHOLDS
The paper says that "the number of resequenced layers must generally be larger than the number of original code-stream layers", therefore, the number of resequenced layers must be an image dependent value.
In this case, the maximum number of resequenced layer has been set to a fixed value but it will be changed in the next revision.
public WindowScalingFactor()
NOTE: Use of this constructor is discouraged, and it only be used by classes that extend this one.
public WindowScalingFactor(JPEG2KLogicalTarget logicalTarget, CacheModel serverCache, JPEG2KCodestream codestream)
codestream
- definition in codestream
.serverCache
- codestream
- public WindowScalingFactor(JPEG2KLogicalTarget logicalTarget, CacheModel serverCache, JPEG2KCodestream codestream, boolean align)
codestream
- definition in codestream
.serverCache
- codestream
- align
- public void setAditionalScalingFactors(PredictiveScalingFactors scalingFactors)
#aditionSF
attribute.aditionalSF
- definition in #aditionalSF
.public void runResponseParameters(ViewWindowField viewWindow) throws ErrorException
viewWindow
- the requested Window Of InterestErrorException
public java.util.ArrayList<RelevantPrecinct> runResponseData() throws ErrorException
ErrorException
public java.util.ArrayList<RelevantPrecinct> runResponseData(long maximumResponseLength) throws ErrorException
maximumResponseLength
- definition in maximumResponseLength
ErrorException
public final void setAlign(boolean align)
align
attribute.public final int getEORReasonCode()
EORReasonCode
attribute.EORReasonCode
attribute.public final ViewWindowField getResponseViewWindow()
responseViewWindow
attribute.responseViewWindow
attribute.public final int getQuality()
quality
attribute.quality
attribute.public static float[] computeResequencedSlopeThresholds(int numSlopeThresholds)
public static int[] computeCompressionSlopeThresholds(COMParameters comParameters, int numLayers)
If thresholds have been saved in the codestream main header's COM marker, their values are used. Otherwise, a log function is used to compute their values.
public java.lang.String toString()
toString
in class java.lang.Object
public void list(java.io.PrintStream out)
out
- an output stream.private void findRelevantPrecinctsResequencedLayers(ViewWindowField actualViewWindow)
actualViewWindow
- protected void packetsSequencing()
Brief explanation of the algorithm: the main loop goes through the weighted slope thresholds and a nested loop through the list of relevant precincts. On each iteration of the main loop, a candidate to be the next threshold is searched among all the relevant precincts. The chosen candidate is the precinct which has the greater weighted threshold value for the next layer of the precinct to be considered.
In each main loop iteration, only those packets with a weighted slope threshold greater than the loop weighted threshold are considered to be delivered to clients.
An exception to this statement is done for the first quality layers. They are prioritized without taken into account the weighted threshold at the beginning of the algorithm. The maximum number of quality layers prioritized is set up by the MAX_PREEMPTED_LAYERS variable, and the preemptedLayers controls which layer is being prioritized. OBS: the idea of prioritizing the first quality layers is based on the assumption that information saved in the first layers have a great contribution in the decoding process. The question about how many layers prioritize depends on the image nature and the compression parameterization.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)