- Timestamp:
- Jun 3, 2015, 4:10:26 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_utils.c
r38340 r38355 174 174 int i, Nbyte; 175 175 176 if (!strcasecmp(cmptype, "GZIP_1") || !strcasecmp(cmptype, "NONE")) { 177 if (out_bitpix == 8) return (1); 178 if (out_bitpix == 16) return (2); 179 if (out_bitpix == 32) return (4); 176 // GZIP_1, GZIP_2 use matched input & output pixels 177 if (!strcasecmp(cmptype, "GZIP_1") || 178 !strcasecmp(cmptype, "GZIP_2") || 179 !strcasecmp(cmptype, "NONE")) { 180 if (out_bitpix == 8) return (1); 181 if (out_bitpix == 16) return (2); 182 if (out_bitpix == 32) return (4); 180 183 if (out_bitpix == -32) return (4); 181 184 if (out_bitpix == -64) return (8); 182 185 return (1); 183 186 } 184 if (!strcasecmp(cmptype, "RICE_1")) { 185 187 188 // RICE_1 must operate on integer pixels 189 if (!strcasecmp(cmptype, "RICE_1") || 190 !strcasecmp(cmptype, "RICE_ONE")) { 186 191 // if BYTEPIX option is specified, use that for Nbyte 187 192 for (i = 0; i < Noptions; i++) { … … 191 196 } 192 197 } 198 if (out_bitpix == 8) return (1); 199 if (out_bitpix == 16) return (2); 200 if (out_bitpix == 32) return (4); 193 201 return (4); 194 202 } 203 204 // PLIO_1 always results in 4-byte ints (not 2 byte ints?) 195 205 if (!strcasecmp(cmptype, "PLIO_1")) { 196 206 return (4); 197 207 } 208 198 209 if (!strcasecmp(cmptype, "HCOMPRESS_1")) { 199 210 if (out_bitpix == 8) return (4); … … 204 215 } 205 216 217 int gfits_compressed_data_pixsize (char *cmptype, int out_bitpix, char **optname, char **optvalue, int Noptions) { 218 219 int i, Nbyte; 220 221 // GZIP_1, GZIP_2 should not be swapped after compression 222 if (!strcasecmp(cmptype, "GZIP_1") || 223 !strcasecmp(cmptype, "GZIP_2") || 224 !strcasecmp(cmptype, "NONE")) { 225 if (out_bitpix == 8) return (1); 226 if (out_bitpix == 16) return (1); 227 if (out_bitpix == 32) return (1); 228 if (out_bitpix == -32) return (1); 229 if (out_bitpix == -64) return (1); 230 return (1); 231 } 232 233 // RICE_1 must operate on integer pixels 234 if (!strcasecmp(cmptype, "RICE_1") || 235 !strcasecmp(cmptype, "RICE_ONE")) { 236 // if BYTEPIX option is specified, use that for Nbyte 237 for (i = 0; i < Noptions; i++) { 238 if (!strcmp(optname[i], "BYTEPIX")) { 239 Nbyte = atoi (optvalue[i]); 240 return (Nbyte); 241 } 242 } 243 if (out_bitpix == 8) return (1); 244 if (out_bitpix == 16) return (2); 245 if (out_bitpix == 32) return (4); 246 return (4); 247 } 248 249 // PLIO_1 always results in 4-byte ints (not 2 byte ints?) 250 if (!strcasecmp(cmptype, "PLIO_1")) { 251 return (4); 252 } 253 254 if (!strcasecmp(cmptype, "HCOMPRESS_1")) { 255 if (out_bitpix == 8) return (4); 256 if (out_bitpix == 16) return (4); 257 return (8); 258 } 259 return (0); 260 } 261 262 int gfits_uncompressed_data_bitpix (char *cmptype, int out_bitpix, char **optname, char **optvalue, int Noptions) { 263 264 int i, Nbyte; 265 266 // GZIP_1, GZIP_2 use matched input & output pixels 267 if (!strcasecmp(cmptype, "GZIP_1") || 268 !strcasecmp(cmptype, "GZIP_2") || 269 !strcasecmp(cmptype, "NONE")) { 270 return (out_bitpix); 271 } 272 273 // RICE_1 must operate on integer pixels 274 if (!strcasecmp(cmptype, "RICE_1") || 275 !strcasecmp(cmptype, "RICE_ONE")) { 276 // if BYTEPIX option is specified, use that for Nbyte 277 for (i = 0; i < Noptions; i++) { 278 if (!strcmp(optname[i], "BYTEPIX")) { 279 Nbyte = atoi (optvalue[i]); 280 return (Nbyte*8); 281 } 282 } 283 if (out_bitpix == 8) return (out_bitpix); 284 if (out_bitpix == 16) return (out_bitpix); 285 if (out_bitpix == 32) return (out_bitpix); 286 return (32); 287 } 288 289 // PLIO_1 always results in 4-byte ints (not 2 byte ints?) 290 if (!strcasecmp(cmptype, "PLIO_1")) { 291 return (32); 292 } 293 294 if (!strcasecmp(cmptype, "HCOMPRESS_1")) { 295 if (out_bitpix == 8) return (32); 296 if (out_bitpix == 16) return (32); 297 return (64); 298 } 299 return (0); 300 } 301 206 302 int gfits_vartable_heap_pixsize (char format) { 207 303
Note:
See TracChangeset
for help on using the changeset viewer.
