[834] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4RTJpeg.hh,v 1.6 2006/06/29 21:23:13 gunter Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[834] | 29 | // |
---|
| 30 | // |
---|
| 31 | |
---|
| 32 | // class description: |
---|
| 33 | // |
---|
| 34 | // This header file defines some static constant variables and error classes |
---|
| 35 | // used internally by G4JpegMaker and related classes |
---|
| 36 | // |
---|
| 37 | |
---|
| 38 | #ifndef G4RTJpeg_H |
---|
| 39 | #define G4RTJpeg_H 1 |
---|
| 40 | |
---|
| 41 | typedef unsigned char u_char; |
---|
| 42 | typedef unsigned int u_int; |
---|
| 43 | |
---|
| 44 | const char JFIF[] = "JFIF"; |
---|
| 45 | const char JFXX[] = "JFXX"; |
---|
| 46 | |
---|
| 47 | const double Sqrt2 = 1.41421356; |
---|
| 48 | const double DisSqrt2 = 1.0 / Sqrt2; |
---|
| 49 | const double PaiDiv16 = 3.14159265 / 16; |
---|
| 50 | |
---|
| 51 | //Zigzag |
---|
| 52 | static const int Zigzag[64] = { |
---|
| 53 | 0, 1, 8, 16, 9, 2, 3, 10, |
---|
| 54 | 17, 24, 32, 25, 18, 11, 4, 5, |
---|
| 55 | 12, 19, 26, 33, 40, 48, 41, 34, |
---|
| 56 | 27, 20, 13, 6, 7, 14, 21, 28, |
---|
| 57 | 35, 42, 49, 56, 57, 50, 43, 36, |
---|
| 58 | 29, 22, 15, 23, 30, 37, 44, 51, |
---|
| 59 | 58, 59, 52, 45, 38, 31, 39, 46, |
---|
| 60 | 53, 60, 61, 54, 47, 55, 62, 63 |
---|
| 61 | }; |
---|
| 62 | |
---|
| 63 | //ProcessResult |
---|
| 64 | enum |
---|
| 65 | jProcessResult{ |
---|
| 66 | M_NoError = 0, |
---|
| 67 | M_RuntimeError = -1, |
---|
| 68 | M_DataError = -2 |
---|
| 69 | }; |
---|
| 70 | |
---|
| 71 | // JpegMarkerCode |
---|
| 72 | enum |
---|
| 73 | jMarker{ |
---|
| 74 | |
---|
| 75 | M_SOF0 = 0xc0, |
---|
| 76 | M_SOF1 = 0xc1, |
---|
| 77 | M_SOF2 = 0xc2, |
---|
| 78 | M_SOF3 = 0xc3, |
---|
| 79 | |
---|
| 80 | M_SOF5 = 0xc5, |
---|
| 81 | M_SOF6 = 0xc6, |
---|
| 82 | M_SOF7 = 0xc7, |
---|
| 83 | |
---|
| 84 | M_JPG = 0xc8, |
---|
| 85 | M_SOF9 = 0xc9, |
---|
| 86 | M_SOF10 = 0xca, |
---|
| 87 | M_SOF11 = 0xcb, |
---|
| 88 | |
---|
| 89 | M_SOF13 = 0xcd, |
---|
| 90 | M_SOF14 = 0xce, |
---|
| 91 | M_SOF15 = 0xcf, |
---|
| 92 | |
---|
| 93 | M_DHT = 0xc4, |
---|
| 94 | |
---|
| 95 | M_DAC = 0xcc, |
---|
| 96 | |
---|
| 97 | M_RST0 = 0xd0, M_RST1 = 0xd1, |
---|
| 98 | M_RST2 = 0xd2, M_RST3 = 0xd3, |
---|
| 99 | M_RST4 = 0xd4, M_RST5 = 0xd5, |
---|
| 100 | M_RST6 = 0xd6, M_RST7 = 0xd7, |
---|
| 101 | |
---|
| 102 | M_SOI = 0xd8, |
---|
| 103 | M_EOI = 0xd9, |
---|
| 104 | M_SOS = 0xda, |
---|
| 105 | M_DQT = 0xdb, |
---|
| 106 | M_DNL = 0xdc, |
---|
| 107 | M_DRI = 0xdd, |
---|
| 108 | M_DHP = 0xde, |
---|
| 109 | M_EXP = 0xdf, |
---|
| 110 | M_COM = 0xfe, |
---|
| 111 | |
---|
| 112 | M_APP0 = 0xe0, M_APP1 = 0xe1, |
---|
| 113 | M_APP2 = 0xe2, M_APP3 = 0xe3, |
---|
| 114 | M_APP4 = 0xe4, M_APP5 = 0xe5, |
---|
| 115 | M_APP6 = 0xe6, M_APP7 = 0xe7, |
---|
| 116 | M_APP8 = 0xe8, M_APP9 = 0xe9, |
---|
| 117 | M_APP10 = 0xea, M_APP11 = 0xeb, |
---|
| 118 | M_APP12 = 0xec, M_APP13 = 0xed, |
---|
| 119 | M_APP14 = 0xee, M_APP15 = 0xef, |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | M_JPG0 = 0xf0, M_JPG1 = 0xf1, |
---|
| 123 | M_JPG2 = 0xf2, M_JPG3 = 0xf3, |
---|
| 124 | M_JPG4 = 0xf4, M_JPG5 = 0xf5, |
---|
| 125 | M_JPG6 = 0xf6, M_JPG7 = 0xf7, |
---|
| 126 | M_JPG8 = 0xf8, M_JPG9 = 0xf9, |
---|
| 127 | M_JPG10 = 0xfa, M_JPG11 = 0xfb, |
---|
| 128 | M_JPG12 = 0xfc, M_JPG13 = 0xfd, |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | M_TEM = 0x01, |
---|
| 132 | M_RESst = 0x02, |
---|
| 133 | M_RESend = 0xbf, |
---|
| 134 | |
---|
| 135 | M_Error = 0xff, |
---|
| 136 | M_Marker = 0xff |
---|
| 137 | }; |
---|
| 138 | |
---|
| 139 | //JpegProperty |
---|
| 140 | struct |
---|
| 141 | G4JpegProperty{ |
---|
| 142 | int nRow; |
---|
| 143 | int nColumn; |
---|
| 144 | int Dimension; |
---|
| 145 | int SamplePrecision; |
---|
| 146 | const char * Comment; |
---|
| 147 | int Format; |
---|
| 148 | u_char MajorRevisions; |
---|
| 149 | u_char MinorRevisions; |
---|
| 150 | int Units; |
---|
| 151 | int HDensity; |
---|
| 152 | int VDensity; |
---|
| 153 | int HThumbnail; |
---|
| 154 | int VThumbnail; |
---|
| 155 | int ExtensionCode; |
---|
| 156 | }; |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | //MemoryError |
---|
| 160 | class G4MemoryError |
---|
| 161 | { |
---|
| 162 | public: |
---|
| 163 | G4MemoryError(int size, const char* message) |
---|
| 164 | {mSize = size; mMessage = message;}; |
---|
| 165 | int mSize; |
---|
| 166 | const char* mMessage; |
---|
| 167 | }; |
---|
| 168 | |
---|
| 169 | //IndexError |
---|
| 170 | class G4IndexError |
---|
| 171 | { |
---|
| 172 | public: |
---|
| 173 | G4IndexError(int maxIndex, int errorIndex, const char* mes) |
---|
| 174 | {mMaxIndex = maxIndex; mErrorIndex = errorIndex; mMessage = mes;}; |
---|
| 175 | int mMaxIndex; |
---|
| 176 | int mErrorIndex; |
---|
| 177 | const char* mMessage; |
---|
| 178 | }; |
---|
| 179 | |
---|
| 180 | //BufferError |
---|
| 181 | class G4BufferError |
---|
| 182 | { |
---|
| 183 | public: |
---|
| 184 | G4BufferError(const char* mes) |
---|
| 185 | {mMessage = mes;}; |
---|
| 186 | const char* mMessage; |
---|
| 187 | }; |
---|
| 188 | |
---|
| 189 | //DataFormatError |
---|
| 190 | class G4DataFormatError |
---|
| 191 | { |
---|
| 192 | public: |
---|
| 193 | G4DataFormatError(void* address, const char* message) |
---|
| 194 | {mAddress = address; mMessage = message;}; |
---|
| 195 | void* mAddress; |
---|
| 196 | const char* mMessage; |
---|
| 197 | }; |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | //NotSupported |
---|
| 201 | class G4NotSupported |
---|
| 202 | { |
---|
| 203 | public: |
---|
| 204 | G4NotSupported(jMarker aMark, void* address) |
---|
| 205 | {mMark = aMark; mAddress = address;}; |
---|
| 206 | jMarker mMark; |
---|
| 207 | void* mAddress; |
---|
| 208 | }; |
---|
| 209 | |
---|
| 210 | #endif |
---|