public class JPEGTurboServiceImpl extends java.lang.Object implements JPEGTurboService
Modifier and Type | Field and Description |
---|---|
private static int |
DRI |
private static int |
EOI |
private byte[] |
header |
private long |
imageDimensions |
private int |
imageHeight |
private int |
imageWidth |
private loci.common.RandomAccessInputStream |
in |
private static boolean |
libraryLoaded |
private java.util.logging.Logger |
logger |
private static org.slf4j.Logger |
LOGGER |
private int |
mcuHeight |
private int |
mcuWidth |
private static java.lang.String |
NATIVE_LIB_CLASS |
private long |
offset |
private int |
restartInterval |
private java.util.ArrayList<java.lang.Long> |
restartMarkers |
private static int |
RST0 |
private static int |
RST7 |
private static int |
SOF0 |
private long |
sos |
private static int |
SOS |
private int |
tileHeight |
private int |
tileWidth |
private int |
xTiles |
private int |
yTiles |
Constructor and Description |
---|
JPEGTurboServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Free resources associated with the initialized stream.
|
byte[] |
getCompressedTile(byte[] data,
int tileX,
int tileY)
Similar to getTile(int, int), but returns the JPEG-compressed bytes.
|
byte[] |
getCompressedTile(int tileX,
int tileY)
Similar to getTile(int, int), but returns the JPEG-compressed bytes.
|
private byte[] |
getFixedHeader() |
long[] |
getRestartMarkers() |
byte[] |
getTile(byte[] buf,
int xCoordinate,
int yCoordinate,
int width,
int height)
Get the uncompressed bytes representing the given bounding box.
|
byte[] |
getTile(int tileX,
int tileY)
Get the uncompressed bytes representing the given tile index.
|
int |
getTileColumns() |
int |
getTileHeight() |
int |
getTileRows() |
int |
getTileWidth() |
void |
initialize(loci.common.RandomAccessInputStream jpeg,
int width,
int height)
Initialize the given stream, which represents an image of the given
width and height.
|
boolean |
isLibraryLoaded() |
private void |
parseSOF() |
void |
setRestartMarkers(long[] markers) |
private static final org.slf4j.Logger LOGGER
private static final java.lang.String NATIVE_LIB_CLASS
private static final int SOF0
private static final int DRI
private static final int SOS
private static final int RST0
private static final int RST7
private static final int EOI
private transient java.util.logging.Logger logger
private int imageWidth
private int imageHeight
private long offset
private loci.common.RandomAccessInputStream in
private int restartInterval
private long sos
private long imageDimensions
private int mcuWidth
private int mcuHeight
private int tileWidth
private int tileHeight
private int xTiles
private int yTiles
private java.util.ArrayList<java.lang.Long> restartMarkers
private byte[] header
private static boolean libraryLoaded
public void setRestartMarkers(long[] markers)
setRestartMarkers
in interface JPEGTurboService
markers
- precalculated restart markers associated with
the current JPEG streampublic long[] getRestartMarkers()
getRestartMarkers
in interface JPEGTurboService
public void initialize(loci.common.RandomAccessInputStream jpeg, int width, int height) throws loci.common.services.ServiceException, java.io.IOException
JPEGTurboService
initialize
in interface JPEGTurboService
jpeg
- open stream containing JPEG datawidth
- total image widthheight
- total image heightloci.common.services.ServiceException
java.io.IOException
public int getTileWidth()
getTileWidth
in interface JPEGTurboService
public int getTileHeight()
getTileHeight
in interface JPEGTurboService
public int getTileRows()
getTileRows
in interface JPEGTurboService
public int getTileColumns()
getTileColumns
in interface JPEGTurboService
public byte[] getTile(byte[] buf, int xCoordinate, int yCoordinate, int width, int height) throws java.io.IOException
JPEGTurboService
getTile
in interface JPEGTurboService
buf
- array in which to store uncompressed bytesxCoordinate
- upper-left X coordinate of bounding boxyCoordinate
- upper-left Y coordinate of bounding boxwidth
- width of bounding boxheight
- height of bounding boxjava.io.IOException
public byte[] getTile(int tileX, int tileY) throws java.io.IOException
JPEGTurboService
getTile
in interface JPEGTurboService
tileX
- column index of the tiletileY
- row index of the tilejava.io.IOException
public byte[] getCompressedTile(int tileX, int tileY) throws java.io.IOException
JPEGTurboService
getCompressedTile
in interface JPEGTurboService
tileX
- column index of the tiletileY
- row index of the tilejava.io.IOException
public byte[] getCompressedTile(byte[] data, int tileX, int tileY) throws java.io.IOException
JPEGTurboService
getCompressedTile
in interface JPEGTurboService
data
- preallocated array for storing tiletileX
- column index of the tiletileY
- row index of the tilejava.io.IOException
public void close() throws java.io.IOException
JPEGTurboService
close
in interface JPEGTurboService
java.io.IOException
public boolean isLibraryLoaded()
isLibraryLoaded
in interface JPEGTurboService
private byte[] getFixedHeader() throws java.io.IOException
java.io.IOException
private void parseSOF() throws java.io.IOException
java.io.IOException
Copyright © 2024 Open Microscopy Environment