00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef G4RTJpeg_H
00038 #define G4RTJpeg_H 1
00039
00040 typedef unsigned char u_char;
00041 typedef unsigned int u_int;
00042
00043 const char JFIF[] = "JFIF";
00044 const char JFXX[] = "JFXX";
00045
00046 const double Sqrt2 = 1.41421356;
00047 const double DisSqrt2 = 1.0 / Sqrt2;
00048 const double PaiDiv16 = 3.14159265 / 16;
00049
00050
00051 static const int Zigzag[64] = {
00052 0, 1, 8, 16, 9, 2, 3, 10,
00053 17, 24, 32, 25, 18, 11, 4, 5,
00054 12, 19, 26, 33, 40, 48, 41, 34,
00055 27, 20, 13, 6, 7, 14, 21, 28,
00056 35, 42, 49, 56, 57, 50, 43, 36,
00057 29, 22, 15, 23, 30, 37, 44, 51,
00058 58, 59, 52, 45, 38, 31, 39, 46,
00059 53, 60, 61, 54, 47, 55, 62, 63
00060 };
00061
00062
00063 enum
00064 jProcessResult{
00065 M_NoError = 0,
00066 M_RuntimeError = -1,
00067 M_DataError = -2
00068 };
00069
00070
00071 enum
00072 jMarker{
00073
00074 M_SOF0 = 0xc0,
00075 M_SOF1 = 0xc1,
00076 M_SOF2 = 0xc2,
00077 M_SOF3 = 0xc3,
00078
00079 M_SOF5 = 0xc5,
00080 M_SOF6 = 0xc6,
00081 M_SOF7 = 0xc7,
00082
00083 M_JPG = 0xc8,
00084 M_SOF9 = 0xc9,
00085 M_SOF10 = 0xca,
00086 M_SOF11 = 0xcb,
00087
00088 M_SOF13 = 0xcd,
00089 M_SOF14 = 0xce,
00090 M_SOF15 = 0xcf,
00091
00092 M_DHT = 0xc4,
00093
00094 M_DAC = 0xcc,
00095
00096 M_RST0 = 0xd0, M_RST1 = 0xd1,
00097 M_RST2 = 0xd2, M_RST3 = 0xd3,
00098 M_RST4 = 0xd4, M_RST5 = 0xd5,
00099 M_RST6 = 0xd6, M_RST7 = 0xd7,
00100
00101 M_SOI = 0xd8,
00102 M_EOI = 0xd9,
00103 M_SOS = 0xda,
00104 M_DQT = 0xdb,
00105 M_DNL = 0xdc,
00106 M_DRI = 0xdd,
00107 M_DHP = 0xde,
00108 M_EXP = 0xdf,
00109 M_COM = 0xfe,
00110
00111 M_APP0 = 0xe0, M_APP1 = 0xe1,
00112 M_APP2 = 0xe2, M_APP3 = 0xe3,
00113 M_APP4 = 0xe4, M_APP5 = 0xe5,
00114 M_APP6 = 0xe6, M_APP7 = 0xe7,
00115 M_APP8 = 0xe8, M_APP9 = 0xe9,
00116 M_APP10 = 0xea, M_APP11 = 0xeb,
00117 M_APP12 = 0xec, M_APP13 = 0xed,
00118 M_APP14 = 0xee, M_APP15 = 0xef,
00119
00120
00121 M_JPG0 = 0xf0, M_JPG1 = 0xf1,
00122 M_JPG2 = 0xf2, M_JPG3 = 0xf3,
00123 M_JPG4 = 0xf4, M_JPG5 = 0xf5,
00124 M_JPG6 = 0xf6, M_JPG7 = 0xf7,
00125 M_JPG8 = 0xf8, M_JPG9 = 0xf9,
00126 M_JPG10 = 0xfa, M_JPG11 = 0xfb,
00127 M_JPG12 = 0xfc, M_JPG13 = 0xfd,
00128
00129
00130 M_TEM = 0x01,
00131 M_RESst = 0x02,
00132 M_RESend = 0xbf,
00133
00134 M_Error = 0xff,
00135 M_Marker = 0xff
00136 };
00137
00138
00139 struct
00140 G4JpegProperty{
00141 G4JpegProperty()
00142 :nRow(0)
00143 ,nColumn(0)
00144 ,Dimension(0)
00145 ,SamplePrecision(0)
00146 ,Comment(0)
00147 ,Format(0)
00148 ,MajorRevisions(0)
00149 ,MinorRevisions(0)
00150 ,Units(0)
00151 ,HDensity(0)
00152 ,VDensity(0)
00153 ,HThumbnail(0)
00154 ,VThumbnail(0)
00155 ,ExtensionCode(0)
00156 {}
00157 int nRow;
00158 int nColumn;
00159 int Dimension;
00160 int SamplePrecision;
00161 const char * Comment;
00162 int Format;
00163 u_char MajorRevisions;
00164 u_char MinorRevisions;
00165 int Units;
00166 int HDensity;
00167 int VDensity;
00168 int HThumbnail;
00169 int VThumbnail;
00170 int ExtensionCode;
00171 };
00172
00173
00174
00175 class G4MemoryError
00176 {
00177 public:
00178 G4MemoryError(int size, const char* message)
00179 {mSize = size; mMessage = message;};
00180 int mSize;
00181 const char* mMessage;
00182 };
00183
00184
00185 class G4IndexError
00186 {
00187 public:
00188 G4IndexError(int maxIndex, int errorIndex, const char* mes)
00189 {mMaxIndex = maxIndex; mErrorIndex = errorIndex; mMessage = mes;};
00190 int mMaxIndex;
00191 int mErrorIndex;
00192 const char* mMessage;
00193 };
00194
00195
00196 class G4BufferError
00197 {
00198 public:
00199 G4BufferError(const char* mes)
00200 {mMessage = mes;};
00201 const char* mMessage;
00202 };
00203
00204
00205 class G4DataFormatError
00206 {
00207 public:
00208 G4DataFormatError(void* address, const char* message)
00209 {mAddress = address; mMessage = message;};
00210 void* mAddress;
00211 const char* mMessage;
00212 };
00213
00214
00215
00216 class G4NotSupported
00217 {
00218 public:
00219 G4NotSupported(jMarker aMark, void* address)
00220 {mMark = aMark; mAddress = address;};
00221 jMarker mMark;
00222 void* mAddress;
00223 };
00224
00225 #endif