markers.go (3301B)
1 package jpegstructure 2 3 import ( 4 "github.com/dsoprea/go-logging" 5 ) 6 7 const ( 8 // MARKER_SOI marker 9 MARKER_SOI = 0xd8 10 11 // MARKER_EOI marker 12 MARKER_EOI = 0xd9 13 14 // MARKER_SOS marker 15 MARKER_SOS = 0xda 16 17 // MARKER_SOD marker 18 MARKER_SOD = 0x93 19 20 // MARKER_DQT marker 21 MARKER_DQT = 0xdb 22 23 // MARKER_APP0 marker 24 MARKER_APP0 = 0xe0 25 26 // MARKER_APP1 marker 27 MARKER_APP1 = 0xe1 28 29 // MARKER_APP2 marker 30 MARKER_APP2 = 0xe2 31 32 // MARKER_APP3 marker 33 MARKER_APP3 = 0xe3 34 35 // MARKER_APP4 marker 36 MARKER_APP4 = 0xe4 37 38 // MARKER_APP5 marker 39 MARKER_APP5 = 0xe5 40 41 // MARKER_APP6 marker 42 MARKER_APP6 = 0xe6 43 44 // MARKER_APP7 marker 45 MARKER_APP7 = 0xe7 46 47 // MARKER_APP8 marker 48 MARKER_APP8 = 0xe8 49 50 // MARKER_APP10 marker 51 MARKER_APP10 = 0xea 52 53 // MARKER_APP12 marker 54 MARKER_APP12 = 0xec 55 56 // MARKER_APP13 marker 57 MARKER_APP13 = 0xed 58 59 // MARKER_APP14 marker 60 MARKER_APP14 = 0xee 61 62 // MARKER_APP15 marker 63 MARKER_APP15 = 0xef 64 65 // MARKER_COM marker 66 MARKER_COM = 0xfe 67 68 // MARKER_CME marker 69 MARKER_CME = 0x64 70 71 // MARKER_SIZ marker 72 MARKER_SIZ = 0x51 73 74 // MARKER_DHT marker 75 MARKER_DHT = 0xc4 76 77 // MARKER_JPG marker 78 MARKER_JPG = 0xc8 79 80 // MARKER_DAC marker 81 MARKER_DAC = 0xcc 82 83 // MARKER_SOF0 marker 84 MARKER_SOF0 = 0xc0 85 86 // MARKER_SOF1 marker 87 MARKER_SOF1 = 0xc1 88 89 // MARKER_SOF2 marker 90 MARKER_SOF2 = 0xc2 91 92 // MARKER_SOF3 marker 93 MARKER_SOF3 = 0xc3 94 95 // MARKER_SOF5 marker 96 MARKER_SOF5 = 0xc5 97 98 // MARKER_SOF6 marker 99 MARKER_SOF6 = 0xc6 100 101 // MARKER_SOF7 marker 102 MARKER_SOF7 = 0xc7 103 104 // MARKER_SOF9 marker 105 MARKER_SOF9 = 0xc9 106 107 // MARKER_SOF10 marker 108 MARKER_SOF10 = 0xca 109 110 // MARKER_SOF11 marker 111 MARKER_SOF11 = 0xcb 112 113 // MARKER_SOF13 marker 114 MARKER_SOF13 = 0xcd 115 116 // MARKER_SOF14 marker 117 MARKER_SOF14 = 0xce 118 119 // MARKER_SOF15 marker 120 MARKER_SOF15 = 0xcf 121 ) 122 123 var ( 124 jpegLogger = log.NewLogger("jpegstructure.jpeg") 125 jpegMagicStandard = []byte{0xff, MARKER_SOI, 0xff} 126 jpegMagic2000 = []byte{0xff, 0x4f, 0xff} 127 128 markerLen = map[byte]int{ 129 0x00: 0, 130 0x01: 0, 131 0xd0: 0, 132 0xd1: 0, 133 0xd2: 0, 134 0xd3: 0, 135 0xd4: 0, 136 0xd5: 0, 137 0xd6: 0, 138 0xd7: 0, 139 0xd8: 0, 140 0xd9: 0, 141 0xda: 0, 142 143 // J2C 144 0x30: 0, 145 0x31: 0, 146 0x32: 0, 147 0x33: 0, 148 0x34: 0, 149 0x35: 0, 150 0x36: 0, 151 0x37: 0, 152 0x38: 0, 153 0x39: 0, 154 0x3a: 0, 155 0x3b: 0, 156 0x3c: 0, 157 0x3d: 0, 158 0x3e: 0, 159 0x3f: 0, 160 0x4f: 0, 161 0x92: 0, 162 0x93: 0, 163 164 // J2C extensions 165 0x74: 4, 166 0x75: 4, 167 0x77: 4, 168 } 169 170 markerNames = map[byte]string{ 171 MARKER_SOI: "SOI", 172 MARKER_EOI: "EOI", 173 MARKER_SOS: "SOS", 174 MARKER_SOD: "SOD", 175 MARKER_DQT: "DQT", 176 MARKER_APP0: "APP0", 177 MARKER_APP1: "APP1", 178 MARKER_APP2: "APP2", 179 MARKER_APP3: "APP3", 180 MARKER_APP4: "APP4", 181 MARKER_APP5: "APP5", 182 MARKER_APP6: "APP6", 183 MARKER_APP7: "APP7", 184 MARKER_APP8: "APP8", 185 MARKER_APP10: "APP10", 186 MARKER_APP12: "APP12", 187 MARKER_APP13: "APP13", 188 MARKER_APP14: "APP14", 189 MARKER_APP15: "APP15", 190 MARKER_COM: "COM", 191 MARKER_CME: "CME", 192 MARKER_SIZ: "SIZ", 193 194 MARKER_DHT: "DHT", 195 MARKER_JPG: "JPG", 196 MARKER_DAC: "DAC", 197 198 MARKER_SOF0: "SOF0", 199 MARKER_SOF1: "SOF1", 200 MARKER_SOF2: "SOF2", 201 MARKER_SOF3: "SOF3", 202 MARKER_SOF5: "SOF5", 203 MARKER_SOF6: "SOF6", 204 MARKER_SOF7: "SOF7", 205 MARKER_SOF9: "SOF9", 206 MARKER_SOF10: "SOF10", 207 MARKER_SOF11: "SOF11", 208 MARKER_SOF13: "SOF13", 209 MARKER_SOF14: "SOF14", 210 MARKER_SOF15: "SOF15", 211 } 212 )