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 JPEGTurboServicemarkers - precalculated restart markers associated with
the current JPEG streampublic long[] getRestartMarkers()
getRestartMarkers in interface JPEGTurboServicepublic void initialize(loci.common.RandomAccessInputStream jpeg,
int width,
int height)
throws loci.common.services.ServiceException,
java.io.IOException
JPEGTurboServiceinitialize in interface JPEGTurboServicejpeg - open stream containing JPEG datawidth - total image widthheight - total image heightloci.common.services.ServiceExceptionjava.io.IOExceptionpublic int getTileWidth()
getTileWidth in interface JPEGTurboServicepublic int getTileHeight()
getTileHeight in interface JPEGTurboServicepublic int getTileRows()
getTileRows in interface JPEGTurboServicepublic int getTileColumns()
getTileColumns in interface JPEGTurboServicepublic byte[] getTile(byte[] buf,
int xCoordinate,
int yCoordinate,
int width,
int height)
throws java.io.IOException
JPEGTurboServicegetTile in interface JPEGTurboServicebuf - 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.IOExceptionpublic byte[] getTile(int tileX,
int tileY)
throws java.io.IOException
JPEGTurboServicegetTile in interface JPEGTurboServicetileX - column index of the tiletileY - row index of the tilejava.io.IOExceptionpublic byte[] getCompressedTile(int tileX,
int tileY)
throws java.io.IOException
JPEGTurboServicegetCompressedTile in interface JPEGTurboServicetileX - column index of the tiletileY - row index of the tilejava.io.IOExceptionpublic byte[] getCompressedTile(byte[] data,
int tileX,
int tileY)
throws java.io.IOException
JPEGTurboServicegetCompressedTile in interface JPEGTurboServicedata - preallocated array for storing tiletileX - column index of the tiletileY - row index of the tilejava.io.IOExceptionpublic void close()
throws java.io.IOException
JPEGTurboServiceclose in interface JPEGTurboServicejava.io.IOExceptionpublic boolean isLibraryLoaded()
isLibraryLoaded in interface JPEGTurboServiceprivate byte[] getFixedHeader()
throws java.io.IOException
java.io.IOExceptionprivate void parseSOF()
throws java.io.IOException
java.io.IOExceptionCopyright © 2025 Open Microscopy Environment