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 BufferedImageprivate ImageReadExceptionprivate IOExceptionprivate final DqtSegment.QuantizationTable[]private final float[][]private SofnSegmentprivate SosSegmentprivate final int[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Block[]booleanbeginSOS()decode(ByteSource byteSource) private intdecode(JpegInputStream is, DhtSegment.HuffmanTable huffmanTable) private intextend(int v, int t) private static intfastRound(float x) getIntervalStartPositions(int[] scanPayload) Returns the positions of where each interval in the provided array starts.private voidreadMCU(JpegInputStream is, int[] preds, Block[] mcu) private intreceive(int ssss, JpegInputStream is) private voidrescaleMCU(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.booleanvisitSegment(int marker, byte[] markerBytes, int segmentLength, byte[] segmentLengthBytes, byte[] segmentData) voidvisitSOS(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:
beginSOSin interfaceJpegUtils.Visitor
-
visitSOS
public void visitSOS(int marker, byte[] markerBytes, byte[] imageData) - Specified by:
visitSOSin interfaceJpegUtils.Visitor
-
visitSegment
public boolean visitSegment(int marker, byte[] markerBytes, int segmentLength, byte[] segmentLengthBytes, byte[] segmentData) throws ImageReadException, IOException - Specified by:
visitSegmentin interfaceJpegUtils.Visitor- Throws:
ImageReadExceptionIOException
-
rescaleMCU
-
allocateMCUMemory
- Throws:
ImageReadException
-
readMCU
private void readMCU(JpegInputStream is, int[] preds, Block[] mcu) throws IOException, ImageReadException - Throws:
IOExceptionImageReadException
-
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:
IOExceptionImageReadException
-
decode
private int decode(JpegInputStream is, DhtSegment.HuffmanTable huffmanTable) throws IOException, ImageReadException - Throws:
IOExceptionImageReadException
-
decode
- Throws:
IOExceptionImageReadException
-