public class PacketHeadersEncoder
extends java.lang.Object
Before any call to the encodePacketHeader(long, int[][][][])
method
(to encode the packet header of a precinct) is is necessary the
setZeroBitPlanesAndFirstLayer(long, int[][][], int[][][])
method
had been called in order to set the first layer and number of zero bit
planes for this precinct. Otherwise, an exception will be thrown.
Each call to the encodePacketHeader(long, int[][][][])
method
generates the packet header belonging to the next quality layer for
the precinct passed as the first function's parameter.
Usage: example:
construct
[setParameters]
setZeroBitPlanesAndFirstLayer
encodePacketHeader
Modifier and Type | Field and Description |
---|---|
private boolean |
emptyHeaderBit
It refers to the zero length packet coding (empty packets).
|
int[][][] |
firstLayer
Definition in
PacketHeaderDataEncoder.firstLayer . |
private int[][][] |
lBlock
Definition in
PacketHeaderDataEncoder.lBlock . |
private PacketHeaderDataOutputStream |
packetHeaderDataOutputStream
ByteStream to built each packet header
|
private java.util.Map<java.lang.Long,PacketHeaderDataEncoder> |
packetHeaders
This object is used to save the packet headers data objects.
|
private TagTreeEncoder[] |
TTInclusionInformation
Definition in
PacketHeaderDataEncoder.TTInclusionInformation . |
private TagTreeEncoder[] |
TTZeroBitPlanes
Definition in
PacketHeaderDataEncoder.TTZeroBitPlanes . |
Constructor and Description |
---|
PacketHeadersEncoder()
Constructor.
|
PacketHeadersEncoder(boolean emptyHeaderBit)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
encodeCodingPasses(int value)
Gives a codeword to the value.
|
private int |
encodeLengths(int lblock,
int[] dataCodingPasses)
Calculate and codify the Lblock value and length of codeword segment
|
byte[] |
encodePacketHeader(long inClassIdentifier,
int[][][][] codingPassesAdded)
Encodes the packet header data in a byte array for the precinct which is
referenced to as layer - component - resolution level - precinct, and
whose coding passed are passed in the
codingPassesAdded
variable. |
int |
getLastEncodedLayer(long inClassIdentifier)
Returns the last encoded layer.
|
byte[] |
getPacketHeaderBuffer()
Returns a byte array with the las packet header which has been encoded.
|
int |
getPacketHeaderLength()
Returns the length of the last encoded packet (in bytes).
|
boolean |
isSet(long inClassIdentifier)
Check whether zero bit planes and first layer has been set for a precinct.
|
void |
list(java.io.PrintStream out)
Prints the Packet Headers Encoder data out to the specified output
stream.
|
void |
reset()
Sets attributes to its initial values.
|
void |
setParameters(boolean emptyHeaderBit)
Set the
emptyHeaderBit attribute. |
void |
setZeroBitPlanesAndFirstLayer(long inClassIdentifier,
int[][][] zeroBitPlanes,
int[][][] firstLayer)
Sets the zero bit planes and first layer for a precinct.
|
java.lang.String |
toString() |
private boolean emptyHeaderBit
private java.util.Map<java.lang.Long,PacketHeaderDataEncoder> packetHeaders
JPIPMessageHeader.inClassIdentifier
)
as a key.private PacketHeaderDataOutputStream packetHeaderDataOutputStream
private TagTreeEncoder[] TTInclusionInformation
PacketHeaderDataEncoder.TTInclusionInformation
.private TagTreeEncoder[] TTZeroBitPlanes
PacketHeaderDataEncoder.TTZeroBitPlanes
.private int[][][] lBlock
PacketHeaderDataEncoder.lBlock
.public int[][][] firstLayer
PacketHeaderDataEncoder.firstLayer
.public PacketHeadersEncoder()
public PacketHeadersEncoder(boolean emptyHeaderBit)
emptyHeaderBit
- definition in emptyHeaderBit
.public void setParameters(boolean emptyHeaderBit)
emptyHeaderBit
attribute.emptyHeaderBit
- definition in emptyHeaderBit
.public void setZeroBitPlanesAndFirstLayer(long inClassIdentifier, int[][][] zeroBitPlanes, int[][][] firstLayer) throws ErrorException
This method must be used only when objects are build using the default
constructor. Moreover, it has to be called once before the
#encodePacketHeader(long, int, int, int, int[][][][])
method
was called for each precinct.
If it is called more than once, an exception will be thrown. Therefore,
in order to avoid it, it is recommended to perform a call to the
isSet(long)
method to check if state data has been set.
zeroBitPlanes
- firstLayer
- ErrorException
public boolean isSet(long inClassIdentifier)
inClassIdentifier
- definition in JPIPMessageHeader.inClassIdentifier
.true
if data has been set. Otherwise, returns
false
.public byte[] encodePacketHeader(long inClassIdentifier, int[][][][] codingPassesAdded) throws ErrorException, java.lang.IllegalAccessException
codingPassesAdded
variable.
The buffer where the packet header are encoded can be retrieved through
the getPacketHeaderBuffer
method.
inClassIdentifier
- definition in JPIPMessageHeader.inClassIdentifier
.codingPassesAdded
- is a multi-dimensional array with the lengths
of each coding-pass which will be included in this packet.
Indexes means:ErrorException
- when an error ocurrs in PacketHeadingCodingjava.lang.IllegalAccessException
public void reset()
public byte[] getPacketHeaderBuffer()
getLastPacketHeaderLength
method.public int getPacketHeaderLength()
public int getLastEncodedLayer(long inClassIdentifier)
inClassIdentifier
- definition in JPIPMessageHeader.inClassIdentifier
.public java.lang.String toString()
toString
in class java.lang.Object
public void list(java.io.PrintStream out)
out
- an output stream.private void encodeCodingPasses(int value) throws ErrorException, java.io.IOException
value
- value to be coded.ErrorException
- when passed value is not validjava.io.IOException
private int encodeLengths(int lblock, int[] dataCodingPasses) throws java.io.IOException
lblock
- current valuedataCodingPasses
- bytes contributed to a packet by the code-blockjava.io.IOException
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)