pixelmed
Classes | Static Public Member Functions | List of all members
com.pixelmed.codec.jpeg.Parse Class Reference

Classes

class  DecompressedOutput
 
class  MarkerSegmentsFoundDuringParse
 

Static Public Member Functions

static MarkerSegmentsFoundDuringParse parse (InputStream in, OutputStream copiedRedactedOutputStream, Vector< Shape > redactionShapes, DecompressedOutput decompressedOutput) throws Exception, IOException
 
static MarkerSegmentsFoundDuringParse parse (InputStream in, OutputStream copiedRedactedOutputStream, Vector< Shape > redactionShapes) throws Exception, IOException
 
static void main (String arg[])
 

Detailed Description

A class to parse a JPEG bitstream.

Includes the ability to selectively redact blocks and leave other blocks alone, to permit "lossless" redaction.

Includes the ability to decompress lossless JPEG.

Development of this class was supported by funding from MDDX Research and Informatics.

Author
dclunie

Definition at line 33 of file Parse.java.

Member Function Documentation

◆ main()

static void com.pixelmed.codec.jpeg.Parse.main ( String  arg[])
static

Test utility to read and write a JPEG file to check parsing is sound.

If only an input file is supplied, will dump rather than copy.

If a decompressed output file is supplied, will write in big endian if precision greater than 8, and will appended component number before file extension iff more than one component.

Parameters
argtwo or three parameters, the input file, the copied compressed output file, and the decompressed output file

Definition at line 503 of file Parse.java.

References com.pixelmed.codec.jpeg.Parse.DecompressedOutput.DecompressedOutput(), and com.pixelmed.codec.jpeg.Parse.parse().

Here is the call graph for this function:

◆ parse() [1/2]

static MarkerSegmentsFoundDuringParse com.pixelmed.codec.jpeg.Parse.parse ( InputStream  in,
OutputStream  copiedRedactedOutputStream,
Vector< Shape >  redactionShapes,
DecompressedOutput  decompressedOutput 
) throws Exception, IOException
static

Parse a JPEG bitstream and either copy to the output redacting any blocks that intersect with the specified locations, or decompress.

Parsing and redaction is implemented only for baseline (8 bit DCT Huffman).

Parsing and decompression is implemented only for lossless sequential Huffman.

Parameters
inthe input JPEG bitstream
copiedRedactedOutputStreamthe output JPEG bitstream, redacted as specified
redactionShapesa Vector of Shape that are Rectangle
decompressedOutputthe decompressed output (with specified or default endianness if precision > 8)
Returns
the marker segments found during parsing
Exceptions
Exceptionif bad things happen parsing the JPEG bit stream, caused by malformed input
IOExceptionif bad things happen reading or writing

Definition at line 169 of file Parse.java.

References com.pixelmed.codec.jpeg.MarkerSegmentDHT.addToMapByClassAndIdentifier(), com.pixelmed.codec.jpeg.MarkerSegmentDQT.addToMapByIdentifier(), com.pixelmed.codec.jpeg.Markers.APP0, com.pixelmed.codec.jpeg.Markers.APP1, com.pixelmed.codec.jpeg.Markers.APP2, com.pixelmed.codec.jpeg.Markers.DHT, com.pixelmed.codec.jpeg.Markers.DNL, com.pixelmed.codec.jpeg.Markers.DQT, com.pixelmed.codec.jpeg.Markers.DRI, com.pixelmed.codec.jpeg.Markers.EOI, com.pixelmed.codec.jpeg.Utilities.extract16be(), com.pixelmed.codec.jpeg.Utilities.extract24be(), com.pixelmed.codec.jpeg.Utilities.extract32be(), com.pixelmed.codec.jpeg.EntropyCodedSegment.finish(), com.pixelmed.codec.jpeg.Markers.getAbbreviation(), com.pixelmed.codec.jpeg.Markers.getDescription(), com.pixelmed.codec.jpeg.MarkerSegmentSOF.getHorizontalSamplingFactor(), com.pixelmed.codec.jpeg.MarkerSegmentSOF.getMarker(), com.pixelmed.codec.jpeg.MarkerSegmentSOF.getNLines(), com.pixelmed.codec.jpeg.MarkerSegmentSOF.getNSamplesPerLine(), com.pixelmed.codec.jpeg.MarkerSegmentSOF.getVerticalSamplingFactor(), com.pixelmed.codec.jpeg.Markers.isDCT(), com.pixelmed.codec.jpeg.Markers.isFixedLengthJPEGSegment(), com.pixelmed.codec.jpeg.Markers.isNoLengthJPEGSegment(), com.pixelmed.codec.jpeg.Markers.isVariableLengthJPEGSegment(), com.pixelmed.codec.jpeg.Utilities.read16be(), com.pixelmed.codec.jpeg.Markers.SOF0, com.pixelmed.codec.jpeg.Markers.SOF1, com.pixelmed.codec.jpeg.Markers.SOF2, com.pixelmed.codec.jpeg.Markers.SOF3, com.pixelmed.codec.jpeg.Markers.SOF5, com.pixelmed.codec.jpeg.Markers.SOF55, com.pixelmed.codec.jpeg.Markers.SOF6, com.pixelmed.codec.jpeg.Markers.SOF7, com.pixelmed.codec.jpeg.Markers.SOF9, com.pixelmed.codec.jpeg.Markers.SOFA, com.pixelmed.codec.jpeg.Markers.SOFB, com.pixelmed.codec.jpeg.Markers.SOFD, com.pixelmed.codec.jpeg.Markers.SOFE, com.pixelmed.codec.jpeg.Markers.SOFF, com.pixelmed.codec.jpeg.Markers.SOS, and com.pixelmed.codec.jpeg.Utilities.toPaddedHexString().

Referenced by com.pixelmed.codec.jpeg.Parse.main(), com.pixelmed.codec.jpeg.Parse.parse(), and com.pixelmed.imageio.JPEGLosslessImageReader.readEverything().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse() [2/2]

static MarkerSegmentsFoundDuringParse com.pixelmed.codec.jpeg.Parse.parse ( InputStream  in,
OutputStream  copiedRedactedOutputStream,
Vector< Shape >  redactionShapes 
) throws Exception, IOException
static

Parse a JPEG bitstream and copying to the output redacting any blocks that intersect with the specified locations.

Parsing and redaction is implemented only for baseline (8 bit DCT Huffman).

Parameters
inthe input JPEG bitstream
copiedRedactedOutputStreamthe output JPEG bitstream, redacted as specified
redactionShapesa Vector of Shape that are Rectangle
Returns
the marker segments found during parsing
Exceptions
Exceptionif bad things happen parsing the JPEG bit stream, caused by malformed input
IOExceptionif bad things happen reading or writing

Definition at line 491 of file Parse.java.

References com.pixelmed.codec.jpeg.Parse.parse().

Here is the call graph for this function: