- Timestamp:
- Jun 5, 2015, 7:58:50 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/matrix/F_uncompress_M.c
r38366 r38399 262 262 int k; 263 263 fprintf (stderr, "unc tbl: "); 264 for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", ftable->buffer[k]); }264 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", ftable->buffer[k]); if (k % 4 == 3) fprintf (stderr, " "); } 265 265 fprintf (stderr, "\n"); 266 266 } … … 279 279 int k; 280 280 fprintf (stderr, "unc dat: "); 281 for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); }281 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 282 282 fprintf (stderr, "\n"); 283 283 } 284 284 285 if (strcasecmp(cmptype, "NONE") && 286 strcasecmp(cmptype, "NONE_2") && 285 if (strcasecmp(cmptype, "NONE_2") && // strcasecmp(cmptype, "NONE") && 287 286 strcasecmp(cmptype, "GZIP_1") && 288 287 strcasecmp(cmptype, "GZIP_2") && … … 296 295 int k; 297 296 fprintf (stderr, "unc SWP: "); 298 for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); }297 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 299 298 fprintf (stderr, "\n"); 300 299 fprintf (stderr, "Nout : %d -> ", Nout); … … 310 309 fprintf (stderr, "%d\n", Nout); 311 310 fprintf (stderr, "unc swp: "); 312 for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", out[k]); }311 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", out[k]); if (k % 4 == 3) fprintf (stderr, " "); } 313 312 fprintf (stderr, "\n"); 314 313 } … … 322 321 int k; 323 322 fprintf (stderr, "unc raw: "); 324 for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", out[k]); }323 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", out[k]); if (k % 4 == 3) fprintf (stderr, " "); } 325 324 fprintf (stderr, "\n"); 326 325 } … … 336 335 int k; 337 336 fprintf (stderr, "unc mat: "); 338 for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", matrix->buffer[k]); }337 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", matrix->buffer[k]); if (k % 4 == 3) fprintf (stderr, " "); } 339 338 fprintf (stderr, "\n"); 340 339 } … … 404 403 int offset = 0; 405 404 406 // we need to set up switches for all of the possible combinations:407 // this macro is used at the inner switch to run the actual loop 408 # define SCALE_AND_DIST_INT (TYPE, SIZE) { \405 int directCopy = (zzero == 0.0) && (zscale == 1.0); 406 407 # define SCALE_AND_DIST_INT_PRINT(TYPE, SIZE) { \ 409 408 TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)]; \ 410 409 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 412 411 *TILEptr = oblank; \ 413 412 } else { \ 414 *TILEptr = *RAWptr * zscale + zzero; \ 413 *TILEptr = directCopy ? *RAWptr : *RAWptr * zscale + zzero; \ 414 fprintf (stderr, "dis: %08x : %08x\n", *TILEptr, *RAWptr); \ 415 415 } } } 416 416 417 417 // we need to set up switches for all of the possible combinations: 418 418 // this macro is used at the inner switch to run the actual loop 419 # define SCALE_AND_DIST_FLOAT(TYPE, SIZE) { \ 420 TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)]; \ 419 # define SCALE_AND_DIST_INT(OTYPE, OSIZE) { \ 420 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 421 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ 422 if (*TILEptr == zblank) { \ 423 *TILEptr = oblank; \ 424 } else { \ 425 if (directCopy) { \ 426 *TILEptr = *RAWptr; \ 427 } else { \ 428 *TILEptr = *RAWptr * zscale + zzero; \ 429 } } } } 430 431 // we need to set up switches for all of the possible combinations: 432 // this macro is used at the inner switch to run the actual loop 433 # define SCALE_AND_DIST_FLOAT(OTYPE, OSIZE) { \ 434 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 421 435 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ 422 436 if (!isfinite(*TILEptr)) { \ 423 437 *TILEptr = oblank; \ 424 438 } else { \ 425 *TILEptr = *RAWptr * zscale + zzero; \ 426 } } } 439 if (directCopy) { \ 440 *TILEptr = *RAWptr; \ 441 } else { \ 442 *TILEptr = *RAWptr * zscale + zzero; \ 443 } } } } 427 444 428 445 // this macro sets up the outer switch and calls above macro with all output bitpix options 429 # define SETUP_RAWSIZE(TYPE, SIZE) { \ 446 # define SETUP_RAWSIZE(ITYPE, ISIZE) { \ 447 ITYPE *RAWptr = (ITYPE *) &raw[i*ISIZE*Ztile[0]]; \ 448 switch (matrix->bitpix) { \ 449 case 8: SCALE_AND_DIST_INT (char, 1); break; \ 450 case 16: SCALE_AND_DIST_INT (short, 2); break; \ 451 case 32: SCALE_AND_DIST_INT (int, 4); break; \ 452 case -32: SCALE_AND_DIST_FLOAT (float, 4); break; \ 453 case -64: SCALE_AND_DIST_FLOAT (double, 8); break; \ 454 default: abort(); \ 455 } } 456 457 // this macro sets up the outer switch and calls above macro with all output bitpix options 458 # define SETUP_RAWSIZE_PRINT(TYPE, SIZE) { \ 430 459 TYPE *RAWptr = (TYPE *) &raw[i*SIZE*Ztile[0]]; \ 431 460 switch (matrix->bitpix) { \ 432 461 case 8: SCALE_AND_DIST_INT (char, 1); break; \ 433 462 case 16: SCALE_AND_DIST_INT (short, 2); break; \ 434 case 32: SCALE_AND_DIST_INT (int, 4); break; \463 case 32: SCALE_AND_DIST_INT (int, 4); break; \ 435 464 case -32: SCALE_AND_DIST_FLOAT (float, 4); break; \ 436 465 case -64: SCALE_AND_DIST_FLOAT (double, 8); break; \ … … 534 563 char *srcptr = &matrix->buffer[size*(offset + start) + k]; 535 564 # endif 536 char *rawptr = &raw[i* size*Ztile[0] + k*Nraw];565 char *rawptr = &raw[i*Ztile[0] + k*Nraw]; 537 566 for (j = 0; j < Ztile[0]; j++, srcptr += size, rawptr ++) { 538 567 if (FALSE && (i == 0) && (j < 4) && (pass == 0)) {
Note:
See TracChangeset
for help on using the changeset viewer.
