32 #include "dcmtk/config/osconfig.h" 33 #include "dcmtk/ofstd/offile.h" 34 #include "dcmtk/ofstd/oflist.h" 35 #include "dcmtk/dcmdata/libi2d/i2dimgs.h" 44 enum E_JPGMARKER { E_JPGMARKER_SOF0 = 0xC0, E_JPGMARKER_SOF1 = 0xC1, E_JPGMARKER_SOF2 = 0xC2,
45 E_JPGMARKER_SOF3 = 0xC3, E_JPGMARKER_SOF5 = 0xC5,
46 E_JPGMARKER_SOF6 = 0xC6, E_JPGMARKER_SOF7 = 0xC7, E_JPGMARKER_JPG = 0xC8,
47 E_JPGMARKER_SOF9 = 0xC9, E_JPGMARKER_SOF10 = 0xCA, E_JPGMARKER_SOF11 = 0xCB,
48 E_JPGMARKER_SOF13 = 0xCD, E_JPGMARKER_SOF14 = 0xCE, E_JPGMARKER_SOF15 = 0xCF,
49 E_JPGMARKER_DHT = 0xC4, E_JPGMARKER_DAC = 0xCC, E_JPGMARKER_RST0 = 0xD0,
50 E_JPGMARKER_RST1 = 0xD1, E_JPGMARKER_RST2 = 0xD2, E_JPGMARKER_RST3 = 0xD3,
51 E_JPGMARKER_RST4 = 0xD4, E_JPGMARKER_RST5 = 0xD5, E_JPGMARKER_RST6 = 0xD6,
52 E_JPGMARKER_RST7 = 0xD7, E_JPGMARKER_SOI = 0xD8, E_JPGMARKER_EOI = 0xD9,
53 E_JPGMARKER_SOS = 0xDA, E_JPGMARKER_DQT = 0xDB, E_JPGMARKER_DNL = 0xDC,
54 E_JPGMARKER_DRI = 0xDD, E_JPGMARKER_DHP = 0xDE, E_JPGMARKER_EXP = 0xDF,
55 E_JPGMARKER_APP0 = 0xE0, E_JPGMARKER_APP1 = 0xE1, E_JPGMARKER_APP2 = 0xE2,
56 E_JPGMARKER_APP3 = 0xE3, E_JPGMARKER_APP4 = 0xE4, E_JPGMARKER_APP5 = 0xE5,
57 E_JPGMARKER_APP6 = 0xE6, E_JPGMARKER_APP7 = 0xE7, E_JPGMARKER_APP8 = 0xE8,
58 E_JPGMARKER_APP9 = 0xE9, E_JPGMARKER_APP10 = 0xEA, E_JPGMARKER_APP11 = 0xEB,
59 E_JPGMARKER_APP12 = 0xEC, E_JPGMARKER_APP13 = 0xED, E_JPGMARKER_APP14 = 0xEE,
60 E_JPGMARKER_APP15 = 0xEF, E_JPGMARKER_JPGN0 = 0xF0, E_JPGMARKER_JPGN1 = 0xF1,
61 E_JPGMARKER_JPGN2 = 0xF2, E_JPGMARKER_JPGN3 = 0xF3, E_JPGMARKER_JPGN4 = 0xF4,
62 E_JPGMARKER_JPGN5 = 0xF5, E_JPGMARKER_JPGN6 = 0xF6, E_JPGMARKER_JPGN7 = 0xF7,
63 E_JPGMARKER_JPGN8 = 0xF8, E_JPGMARKER_JPGN9 = 0xF9, E_JPGMARKER_JPGN10 = 0xFA,
64 E_JPGMARKER_JPGN11 = 0xFB, E_JPGMARKER_JPGN12 = 0xFC, E_JPGMARKER_JPGN13 = 0xFD,
65 E_JPGMARKER_COM = 0xFE, E_JPGMARKER_TEM = 0x01, E_JPGMARKER_RES0 = 0x02,
66 E_JPGMARKER_RESN = 0xBF };
121 Uint16& samplesPerPixel,
132 E_TransferSyntax& ts);
143 OFCondition getLossyComprInfo(OFBool& srcEncodingLossy,
144 OFString& srcLossyComprMethod)
const;
150 void setExtSeqSupport(
const OFBool enabled);
156 void setProgrSupport(
const OFBool enabled);
162 void setInsistOnJFIF(
const OFBool enabled);
172 void setKeepAPPn(
const OFBool enabled);
209 void debugDumpJPEGFileMap()
const;
222 Uint16& samplesPerPixel,
223 Uint16& bitsPerSample);
235 Uint16& pixelAspectH,
236 Uint16& pixelAspectV,
244 OFCondition isJPEGEncodingSupported(
const E_JPGMARKER& jpegEncoding)
const;
252 static E_TransferSyntax associatedTS(
const E_JPGMARKER& jpegEncoding);
258 static OFBool isRSTMarker(
const E_JPGMARKER& jpegEncoding);
264 static OFBool isSOFMarker(
const E_JPGMARKER& jpegEncoding);
301 OFCondition nextMarker(
const OFBool& lastWasSOSMarker,
302 E_JPGMARKER& result);
308 inline int read2Bytes(Uint16& result);
314 inline int read1Byte(Uint8& result);
350 #endif // #ifndef I2DJPGS_H this class provides a simple C++ encapsulation layer for stdio FILE pointers.
OFBool m_keepAPPn
If true, APPn markers (except JFIF!) are also copied to the output file.
offile_off_t bytePos
The byte position of the marker.
OFBool m_disableExtSeqTs
If true, JPEGs with extended sequential coding are not supported.
OFBool m_insistOnJFIF
If true, conversion will only work if JFIF header can be found.
OFBool m_disableProgrTs
If true, JPEGs with progressive coding are not supported.
OFFile jpegFile
The JPEG file, if opened.
OFBool m_lossyCompressed
After reading pixel data, this denotes whether the source data is already lossy compressed.
Struct that represents a marker in a JPEG file, i.e.
OFList< JPEGFileMapEntry * > m_jpegFileMap
JPEG file map. This map includes all JPEG markers and their byte positions in the JPEG file...
a simple string class that implements a subset of std::string.
E_JPGMARKER marker
The marker byte itself.
General purpose class for condition codes.