Class JpegDecoder
java.lang.Object
org.apache.commons.imaging.common.BinaryFileParser
org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder
- All Implemented Interfaces:
JpegUtils.Visitor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final float[]
private final int[]
private final DhtSegment.HuffmanTable[]
private final DhtSegment.HuffmanTable[]
private BufferedImage
private ImageReadException
private IOException
private final DqtSegment.QuantizationTable[]
private final float[][]
private SofnSegment
private SosSegment
private final int[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Block[]
boolean
beginSOS()
decode
(ByteSource byteSource) private int
decode
(JpegInputStream is, DhtSegment.HuffmanTable huffmanTable) private int
extend
(int v, int t) private static int
fastRound
(float x) getIntervalStartPositions
(int[] scanPayload) Returns the positions of where each interval in the provided array starts.private void
readMCU
(JpegInputStream is, int[] preds, Block[] mcu) private int
receive
(int ssss, JpegInputStream is) private void
rescaleMCU
(Block[] dataUnits, int hSize, int vSize, Block[] ret) (package private) static JpegInputStream[]
splitByRstMarkers
(int[] scanPayload) Returns an array of JpegInputStream where each field contains the JpegInputStream for one interval.boolean
visitSegment
(int marker, byte[] markerBytes, int segmentLength, byte[] segmentLengthBytes, byte[] segmentData) void
visitSOS
(int marker, byte[] markerBytes, byte[] imageData) Methods inherited from class org.apache.commons.imaging.common.BinaryFileParser
debugNumber, debugNumber, getByteOrder, setByteOrder
-
Field Details
-
quantizationTables
-
huffmanDCTables
-
huffmanACTables
-
sofnSegment
-
sosSegment
-
scaledQuantizationTables
private final float[][] scaledQuantizationTables -
image
-
imageReadException
-
ioException
-
zz
private final int[] zz -
blockInt
private final int[] blockInt -
block
private final float[] block
-
-
Constructor Details
-
JpegDecoder
public JpegDecoder()
-
-
Method Details
-
beginSOS
public boolean beginSOS()- Specified by:
beginSOS
in interfaceJpegUtils.Visitor
-
visitSOS
public void visitSOS(int marker, byte[] markerBytes, byte[] imageData) - Specified by:
visitSOS
in interfaceJpegUtils.Visitor
-
visitSegment
public boolean visitSegment(int marker, byte[] markerBytes, int segmentLength, byte[] segmentLengthBytes, byte[] segmentData) throws ImageReadException, IOException - Specified by:
visitSegment
in interfaceJpegUtils.Visitor
- Throws:
ImageReadException
IOException
-
rescaleMCU
-
allocateMCUMemory
- Throws:
ImageReadException
-
readMCU
private void readMCU(JpegInputStream is, int[] preds, Block[] mcu) throws IOException, ImageReadException - Throws:
IOException
ImageReadException
-
splitByRstMarkers
Returns an array of JpegInputStream where each field contains the JpegInputStream for one interval.- Parameters:
scanPayload
- array to read intervals from- Returns:
- JpegInputStreams for all intervals, at least one stream is always provided
-
getIntervalStartPositions
Returns the positions of where each interval in the provided array starts. The number of start positions is also the count of intervals while the number of restart markers found is equal to the number of start positions minus one (because restart markers are between intervals).- Parameters:
scanPayload
- array to examine- Returns:
- the start positions
-
fastRound
private static int fastRound(float x) -
extend
private int extend(int v, int t) -
receive
- Throws:
IOException
ImageReadException
-
decode
private int decode(JpegInputStream is, DhtSegment.HuffmanTable huffmanTable) throws IOException, ImageReadException - Throws:
IOException
ImageReadException
-
decode
- Throws:
IOException
ImageReadException
-