Changeset 39409
- Timestamp:
- Feb 26, 2016, 8:31:22 PM (10 years ago)
- Location:
- branches/eam_branches/ohana.20160226/src
- Files:
-
- 40 edited
-
libdvo/include/libdvo_astro.h (modified) (1 diff)
-
libdvo/src/AstromOffsetMapIO.c (modified) (3 diffs)
-
libdvo/src/AstromOffsetMapUtils.c (modified) (1 diff)
-
libdvo/src/dvo_catalog_chipcoords.c (modified) (1 diff)
-
libdvo/src/dvo_catalog_mef.c (modified) (1 diff)
-
libdvo/src/dvo_catalog_raw.c (modified) (1 diff)
-
libdvo/src/dvo_convert.c (modified) (6 diffs)
-
libdvo/src/dvo_convert_PS1_DEV_1.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_PS1_DEV_2.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_PS1_REF.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_PS1_SIM.c (modified) (4 diffs)
-
libdvo/src/dvo_convert_PS1_V1.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_PS1_V2.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_PS1_V3.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_PS1_V4.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_PS1_V5.c (modified) (5 diffs)
-
libdvo/src/dvo_convert_panstarrs_DEV_0.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_panstarrs_DEV_1.c (modified) (2 diffs)
-
libdvo/src/dvo_photcode_ops.c (modified) (22 diffs)
-
libdvo/src/dvosorts.c (modified) (1 diff)
-
libfits/extern/gzip.c (modified) (6 diffs)
-
libfits/header/F_write_H.c (modified) (1 diff)
-
libfits/include/gfitsio.h (modified) (2 diffs)
-
libfits/matrix/F_compress_M.c (modified) (22 diffs)
-
libfits/matrix/F_compress_data.c (modified) (7 diffs)
-
libfits/matrix/F_compress_utils.c (modified) (7 diffs)
-
libfits/matrix/F_convert_format.c (modified) (3 diffs)
-
libfits/matrix/F_uncompress_M.c (modified) (27 diffs)
-
libfits/matrix/F_uncompress_data.c (modified) (6 diffs)
-
libfits/table/F_compress_T.c (modified) (25 diffs)
-
libfits/table/F_uncompress_T.c (modified) (4 diffs)
-
libfits/table/F_write_T.c (modified) (1 diff)
-
libfits/table/F_write_TH.c (modified) (1 diff)
-
libohana/include/ohana.h (modified) (1 diff)
-
libohana/src/Fread.c (modified) (2 diffs)
-
libohana/src/config.c (modified) (1 diff)
-
libohana/src/gaussj.c (modified) (1 diff)
-
libohana/src/isolate_elements.c (modified) (3 diffs)
-
libohana/src/ohana_allocate.c (modified) (1 diff)
-
relastro/src/UpdateObjects.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20160226/src/libdvo/include/libdvo_astro.h
r39245 r39409 68 68 AstromOffsetMap **map; 69 69 int *imageIDtoTableSeq; 70 int MaxImageID;71 int MaxTableID;70 unsigned int MaxImageID; 71 unsigned int MaxTableID; 72 72 } AstromOffsetTable; 73 73 -
branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapIO.c
r38986 r39409 148 148 AstromOffsetTable *AstromOffsetMapToTable(AstromOffsetMap_Disk_6x6 *map_disk, off_t Nmap) { 149 149 150 int i, j, k; 150 unsigned int i; 151 int j, k; 151 152 152 153 AstromOffsetTable *table = NULL; … … 157 158 158 159 // find the max value of imageID 159 int MaxTableID = 0;160 int MaxImageID = 0;160 unsigned int MaxTableID = 0; 161 unsigned int MaxImageID = 0; 161 162 for (i = 0; i < Nmap; i++) { 162 MaxTableID = MAX( map_disk[i].tableID, MaxTableID);163 MaxImageID = MAX( map_disk[i].imageID, MaxImageID);163 MaxTableID = MAX(MaxTableID, map_disk[i].tableID); 164 MaxImageID = MAX(MaxImageID, map_disk[i].imageID); 164 165 } 165 166 table->MaxTableID = MaxTableID; … … 312 313 int AstromOffsetTableSetIDs (AstromOffsetTable *table) { 313 314 314 int i;315 316 315 // find the max value of imageID 317 int MaxTableID = 0; 318 int MaxImageID = 0; 319 for (i = 0; i < table->Nmap; i++) { 320 MaxTableID = MAX(table->map[i][0].tableID, MaxTableID); 321 MaxImageID = MAX(table->map[i][0].imageID, MaxImageID); 322 } 323 table->MaxTableID = MaxTableID; 324 table->MaxImageID = MaxImageID; 316 unsigned int MaxTableID = 0; 317 unsigned int MaxImageID = 0; 318 { 319 int j; 320 for (j = 0; j < table->Nmap; j++) { 321 MaxTableID = MAX(MaxTableID, table->map[j][0].tableID); 322 MaxImageID = MAX(MaxImageID, table->map[j][0].imageID); 323 } 324 table->MaxTableID = MaxTableID; 325 table->MaxImageID = MaxImageID; 326 } 325 327 326 328 // generate the index and init values to -1 327 ALLOCATE (table->imageIDtoTableSeq, int, MaxImageID + 1); 328 for (i = 0; i <= MaxImageID; i++) { 329 table->imageIDtoTableSeq[i] = -1; 329 { 330 unsigned int i; 331 ALLOCATE (table->imageIDtoTableSeq, int, MaxImageID + 1); 332 for (i = 0; i <= MaxImageID; i++) { 333 table->imageIDtoTableSeq[i] = -1; 334 } 330 335 } 331 336 332 337 // assign the ID values 333 for (i = 0; i < table->Nmap; i++) { 334 int ImageID = table->map[i][0].imageID; 335 myAssert (table->imageIDtoTableSeq[ImageID] == -1, "oops, duplicate image IDs"); 336 table->imageIDtoTableSeq[ImageID] = i; 338 { 339 int j; 340 for (j = 0; j < table->Nmap; j++) { 341 int ImageID = table->map[j][0].imageID; 342 myAssert (table->imageIDtoTableSeq[ImageID] == -1, "oops, duplicate image IDs"); 343 table->imageIDtoTableSeq[ImageID] = j; 344 } 337 345 } 338 346 return TRUE; -
branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapUtils.c
r38986 r39409 11 11 off_t i; 12 12 for (i = 0; i < Nimages; i++) { 13 int imageID = images[i].imageID; 14 if (imageID < 0) continue; 13 if (images[i].imageID < 0) continue; 14 15 unsigned int imageID = images[i].imageID; 15 16 if (imageID > table->MaxImageID) continue; 16 17 -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_chipcoords.c
r37035 r39409 1 1 # include <dvo.h> 2 2 3 int dvo_match_image (Image *image, int Nimage, unsignedint T, short int S) {3 int dvo_match_image (Image *image, int Nimage, int T, short int S) { 4 4 5 5 int N, Nlo, Nhi, N1, N2; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_mef.c
r38441 r39409 17 17 it is not defined for a legacy database, we can generate them using the existing index values. 18 18 If it is missing, give a warning and recommend the user upgrade the DB */ 19 if (!gfits_scan (&catalog[0].header, "OBJID", "% d", 1, &catalog[0].objID)) {19 if (!gfits_scan (&catalog[0].header, "OBJID", "%u", 1, &catalog[0].objID)) { 20 20 if (VERBOSE) fprintf (stderr, "WARNING: OBJID is not set for %s: upgrade for full feature set\n", catalog[0].filename); 21 21 catalog[0].objID = 0; 22 22 } 23 if (!gfits_scan (&catalog[0].header, "CATID", "% d", 1, &catalog[0].catID)) {23 if (!gfits_scan (&catalog[0].header, "CATID", "%u", 1, &catalog[0].catID)) { 24 24 if (VERBOSE) fprintf (stderr, "WARNING: CATID is not set for %s: upgrade for full feature set\n", catalog[0].filename); 25 25 catalog[0].catID = 0; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_raw.c
r38441 r39409 29 29 it is not defined for a legacy database, we can generate them using the existing index values. 30 30 If it is missing, give a warning and recommend the user upgrade the DB */ 31 if (!gfits_scan (&catalog[0].header, "OBJID", "% d", 1, &catalog[0].objID)) {31 if (!gfits_scan (&catalog[0].header, "OBJID", "%u", 1, &catalog[0].objID)) { 32 32 if (VERBOSE) fprintf (stderr, "WARNING: OBJID is not set for this database: upgrade for full feature set\n"); 33 33 catalog[0].objID = 0; 34 34 } 35 if (!gfits_scan (&catalog[0].header, "CATID", "% d", 1, &catalog[0].catID)) {35 if (!gfits_scan (&catalog[0].header, "CATID", "%u", 1, &catalog[0].catID)) { 36 36 if (VERBOSE) fprintf (stderr, "WARNING: CATID is not set for this database: upgrade for full feature set\n"); 37 37 catalog[0].catID = 0; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert.c
r38986 r39409 320 320 321 321 Missing *FtableToMissing (FTable *ftable, Average *average, off_t *Nmissing, DVOCatFormat *format, char nativeBytes) { 322 OHANA_UNUSED_PARAM(average); 322 323 323 324 Missing *missing; … … 397 398 398 399 SecFilt *FtableToSecFilt (FTable *ftable, Average *average, off_t *Nsecfilt, DVOCatFormat *format, char nativeBytes) { 400 OHANA_UNUSED_PARAM(average); 399 401 400 402 SecFilt *secfilt; … … 509 511 510 512 Lensing *FtableToLensing (FTable *ftable, Average *average, off_t *Nlensing, DVOCatFormat *format, char nativeBytes) { 513 OHANA_UNUSED_PARAM(average); 511 514 512 515 Lensing *lensing; … … 652 655 653 656 Lensobj *FtableToLensobj (FTable *ftable, Average *average, off_t *Nlensobj, DVOCatFormat *format, char nativeBytes) { 657 OHANA_UNUSED_PARAM(average); 654 658 655 659 Lensobj *lensobj; … … 769 773 770 774 StarPar *FtableToStarPar (FTable *ftable, Average *average, off_t *Nstarpar, DVOCatFormat *format, char nativeBytes) { 775 OHANA_UNUSED_PARAM(average); 771 776 772 777 StarPar *starpar; … … 874 879 875 880 GalPhot *FtableToGalPhot (FTable *ftable, Average *average, off_t *Ngalphot, DVOCatFormat *format, char nativeBytes) { 881 OHANA_UNUSED_PARAM(average); 876 882 877 883 GalPhot *galphot; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_DEV_1.c
r38462 r39409 100 100 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 101 101 Average *Average_PS1_DEV_1_ToInternal (Average_PS1_DEV_1 *in, off_t Nvalues, SecFilt **primary) { 102 OHANA_UNUSED_PARAM(primary); 102 103 103 104 off_t i; … … 138 139 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 139 140 Average_PS1_DEV_1 *AverageInternalTo_PS1_DEV_1 (Average *in, off_t Nvalues, SecFilt *primary) { 141 OHANA_UNUSED_PARAM(primary); 140 142 141 143 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_DEV_2.c
r38462 r39409 97 97 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 98 98 Average *Average_PS1_DEV_2_ToInternal (Average_PS1_DEV_2 *in, off_t Nvalues, SecFilt **primary) { 99 OHANA_UNUSED_PARAM(primary); 99 100 100 101 off_t i; … … 133 134 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 134 135 Average_PS1_DEV_2 *AverageInternalTo_PS1_DEV_2 (Average *in, off_t Nvalues, SecFilt *primary) { 136 OHANA_UNUSED_PARAM(primary); 135 137 136 138 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_REF.c
r38462 r39409 55 55 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 56 56 Average *Average_PS1_REF_ToInternal (Average_PS1_REF *in, off_t Nvalues, SecFilt **primary) { 57 OHANA_UNUSED_PARAM(primary); 57 58 58 59 off_t i; … … 80 81 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 81 82 Average_PS1_REF *AverageInternalTo_PS1_REF (Average *in, off_t Nvalues, SecFilt *primary) { 83 OHANA_UNUSED_PARAM(primary); 82 84 83 85 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_SIM.c
r39262 r39409 4 4 5 5 Measure *Measure_PS1_SIM_ToInternal (Average *ave, Measure_PS1_SIM *in, off_t Nvalues) { 6 OHANA_UNUSED_PARAM(ave); 6 7 7 8 off_t i; … … 51 52 52 53 Measure_PS1_SIM *MeasureInternalTo_PS1_SIM (Average *ave, Measure *in, off_t Nvalues) { 54 OHANA_UNUSED_PARAM(ave); 53 55 54 56 off_t i; … … 97 99 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 98 100 Average *Average_PS1_SIM_ToInternal (Average_PS1_SIM *in, off_t Nvalues, SecFilt **primary) { 101 OHANA_UNUSED_PARAM(primary); 99 102 100 103 off_t i; … … 143 146 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 144 147 Average_PS1_SIM *AverageInternalTo_PS1_SIM (Average *in, off_t Nvalues, SecFilt *primary) { 148 OHANA_UNUSED_PARAM(primary); 145 149 146 150 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V1.c
r38462 r39409 115 115 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 116 116 Average *Average_PS1_V1_ToInternal (Average_PS1_V1 *in, off_t Nvalues, SecFilt **primary) { 117 OHANA_UNUSED_PARAM(primary); 117 118 118 119 off_t i; … … 152 153 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 153 154 Average_PS1_V1 *AverageInternalTo_PS1_V1 (Average *in, off_t Nvalues, SecFilt *primary) { 155 OHANA_UNUSED_PARAM(primary); 154 156 155 157 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V2.c
r38462 r39409 116 116 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 117 117 Average *Average_PS1_V2_ToInternal (Average_PS1_V2 *in, off_t Nvalues, SecFilt **primary) { 118 OHANA_UNUSED_PARAM(primary); 118 119 119 120 off_t i; … … 157 158 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 158 159 Average_PS1_V2 *AverageInternalTo_PS1_V2 (Average *in, off_t Nvalues, SecFilt *primary) { 160 OHANA_UNUSED_PARAM(primary); 159 161 160 162 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V3.c
r38462 r39409 116 116 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 117 117 Average *Average_PS1_V3_ToInternal (Average_PS1_V3 *in, off_t Nvalues, SecFilt **primary) { 118 OHANA_UNUSED_PARAM(primary); 118 119 119 120 off_t i; … … 159 160 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 160 161 Average_PS1_V3 *AverageInternalTo_PS1_V3 (Average *in, off_t Nvalues, SecFilt *primary) { 162 OHANA_UNUSED_PARAM(primary); 161 163 162 164 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V4.c
r38462 r39409 134 134 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 135 135 Average *Average_PS1_V4_ToInternal (Average_PS1_V4 *in, off_t Nvalues, SecFilt **primary) { 136 OHANA_UNUSED_PARAM(primary); 136 137 137 138 off_t i; … … 180 181 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 181 182 Average_PS1_V4 *AverageInternalTo_PS1_V4 (Average *in, off_t Nvalues, SecFilt *primary) { 183 OHANA_UNUSED_PARAM(primary); 182 184 183 185 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V5.c
r39262 r39409 4 4 5 5 Measure *Measure_PS1_V5_ToInternal (Average *ave, Measure_PS1_V5 *in, off_t Nvalues) { 6 OHANA_UNUSED_PARAM(ave); 6 7 7 8 off_t i; … … 79 80 80 81 Measure_PS1_V5 *MeasureInternalTo_PS1_V5 (Average *ave, Measure *in, off_t Nvalues) { 82 OHANA_UNUSED_PARAM(ave); 81 83 82 84 off_t i; … … 153 155 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 154 156 Average *Average_PS1_V5_ToInternal (Average_PS1_V5 *in, off_t Nvalues, SecFilt **primary) { 157 OHANA_UNUSED_PARAM(primary); 155 158 156 159 off_t i; … … 225 228 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 226 229 Average_PS1_V5 *AverageInternalTo_PS1_V5 (Average *in, off_t Nvalues, SecFilt *primary) { 230 OHANA_UNUSED_PARAM(primary); 227 231 228 232 off_t i; … … 1640 1644 1641 1645 Measure *Measure_PS1_V5alt_ToInternal (Average *ave, Measure_PS1_V5alt *in, off_t Nvalues) { 1646 OHANA_UNUSED_PARAM(ave); 1642 1647 1643 1648 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
r38462 r39409 106 106 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used 107 107 Average *Average_Panstarrs_DEV_0_ToInternal (Average_Panstarrs_DEV_0 *in, off_t Nvalues, SecFilt **primary) { 108 OHANA_UNUSED_PARAM(primary); 108 109 109 110 off_t i; … … 143 144 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used 144 145 Average_Panstarrs_DEV_0 *AverageInternalTo_Panstarrs_DEV_0 (Average *in, off_t Nvalues, SecFilt *primary) { 146 OHANA_UNUSED_PARAM(primary); 145 147 146 148 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
r38462 r39409 106 106 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used 107 107 Average *Average_Panstarrs_DEV_1_ToInternal (Average_Panstarrs_DEV_1 *in, off_t Nvalues, SecFilt **primary) { 108 OHANA_UNUSED_PARAM(primary); 108 109 109 110 off_t i; … … 143 144 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used 144 145 Average_Panstarrs_DEV_1 *AverageInternalTo_Panstarrs_DEV_1 (Average *in, off_t Nvalues, SecFilt *primary) { 146 OHANA_UNUSED_PARAM(primary); 145 147 146 148 off_t i; -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_photcode_ops.c
r39277 r39409 467 467 /***/ 468 468 float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 469 OHANA_UNUSED_PARAM(average); 469 470 470 471 if (code == NULL) return NAN; … … 572 573 573 574 float PhotCalErr (Measure *measure, dvoMagClassType class) { 575 OHANA_UNUSED_PARAM(class); 574 576 575 577 float dMcal = measure[0].dMcal; … … 578 580 579 581 float PhotAveErr (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 582 OHANA_UNUSED_PARAM(average); 580 583 581 584 if (code == NULL) return NAN; … … 640 643 641 644 float PhotZeroPoint (Measure *measure, Average *average, SecFilt *secfilt) { 645 OHANA_UNUSED_PARAM(average); 646 OHANA_UNUSED_PARAM(secfilt); 642 647 643 648 int Np; … … 710 715 711 716 float PhotMstdev (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 717 OHANA_UNUSED_PARAM(average); 712 718 713 719 if (code == NULL) return NAN; … … 757 763 // return the number of detections in this filter (gpc1) 758 764 int PhotNcode (PhotCode *code, Average *average, SecFilt *secfilt) { 765 OHANA_UNUSED_PARAM(average); 759 766 760 767 if (code == NULL) return 0; … … 768 775 // return the number of detections in this filter (gpc1) 769 776 int PhotSecfiltFlags (PhotCode *code, Average *average, SecFilt *secfilt) { 777 OHANA_UNUSED_PARAM(average); 770 778 771 779 if (code == NULL) return 0; … … 778 786 779 787 int PhotNphot (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 788 OHANA_UNUSED_PARAM(average); 780 789 781 790 if (code == NULL) return 0; … … 824 833 825 834 float PhotAveFluxPSF (PhotCode *code, Average *average, SecFilt *secfilt) { 835 OHANA_UNUSED_PARAM(average); 826 836 827 837 int Ns; … … 836 846 837 847 float PhotAvedFluxPSF (PhotCode *code, Average *average, SecFilt *secfilt) { 848 OHANA_UNUSED_PARAM(average); 838 849 839 850 int Ns; … … 848 859 849 860 float PhotAveFluxKron (PhotCode *code, Average *average, SecFilt *secfilt) { 861 OHANA_UNUSED_PARAM(average); 850 862 851 863 int Ns; … … 860 872 861 873 float PhotAvedFluxKron (PhotCode *code, Average *average, SecFilt *secfilt) { 874 OHANA_UNUSED_PARAM(average); 862 875 863 876 int Ns; … … 872 885 873 886 float PhotMmin (PhotCode *code, Average *average, SecFilt *secfilt) { 887 OHANA_UNUSED_PARAM(average); 874 888 875 889 int Ns; … … 884 898 885 899 float PhotMmax (PhotCode *code, Average *average, SecFilt *secfilt) { 900 OHANA_UNUSED_PARAM(average); 886 901 887 902 int Ns; … … 896 911 897 912 float PhotUCdist (PhotCode *code, Average *average, SecFilt *secfilt) { 913 OHANA_UNUSED_PARAM(average); 898 914 899 915 int Ns; … … 921 937 // Xm is now (2014.07.03) stored as the chisq except in dvo formats which use as short 922 938 float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt) { 939 OHANA_UNUSED_PARAM(average); 923 940 924 941 int Ns; … … 1188 1205 /***/ 1189 1206 float PhotFluxAve (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 1207 OHANA_UNUSED_PARAM(average); 1190 1208 1191 1209 if (code == NULL) return NAN; … … 1248 1266 1249 1267 float PhotFluxAveErr (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 1268 OHANA_UNUSED_PARAM(average); 1250 1269 1251 1270 if (code == NULL) return NAN; … … 1610 1629 /***/ 1611 1630 float PhotAveTiny (PhotCode *code, AverageTiny *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 1631 OHANA_UNUSED_PARAM(average); 1612 1632 1613 1633 if (code == NULL) return NAN; … … 1746 1766 1747 1767 float PhotdMTiny (PhotCode *code, AverageTiny *average, SecFilt *secfilt) { 1768 OHANA_UNUSED_PARAM(average); 1748 1769 1749 1770 int Ns; … … 1759 1780 // Xm is now (2014.07.03) stored as the chisq except in dvo formats which use as short 1760 1781 float PhotXmTiny (PhotCode *code, AverageTiny *average, SecFilt *secfilt) { 1782 OHANA_UNUSED_PARAM(average); 1761 1783 1762 1784 int Ns; … … 1853 1875 } 1854 1876 1855 LENSFIELD(X11_sm_obj) ;1856 LENSFIELD(X12_sm_obj) ;1857 LENSFIELD(X22_sm_obj) ;1858 LENSFIELD(E1_sm_obj) ;1859 LENSFIELD(E2_sm_obj) ;1860 1861 LENSFIELD(X11_sh_obj) ;1862 LENSFIELD(X12_sh_obj) ;1863 LENSFIELD(X22_sh_obj) ;1864 LENSFIELD(E1_sh_obj) ;1865 LENSFIELD(E2_sh_obj) ;1866 1867 LENSFIELD(X11_sm_psf) ;1868 LENSFIELD(X12_sm_psf) ;1869 LENSFIELD(X22_sm_psf) ;1870 LENSFIELD(E1_sm_psf) ;1871 LENSFIELD(E2_sm_psf) ;1872 1873 LENSFIELD(X11_sh_psf) ;1874 LENSFIELD(X12_sh_psf) ;1875 LENSFIELD(X22_sh_psf) ;1876 LENSFIELD(E1_sh_psf) ;1877 LENSFIELD(E2_sh_psf) ;1878 1879 LENSFIELD( F_ApR5) ;1880 LENSFIELD(dF_ApR5) ;1881 LENSFIELD(sF_ApR5) ;1882 LENSFIELD(fF_ApR5) ;1883 1884 LENSFIELD( F_ApR6) ;1885 LENSFIELD(dF_ApR6) ;1886 LENSFIELD(sF_ApR6) ;1887 LENSFIELD(fF_ApR6) ;1888 1889 LENSFIELD( F_ApR7) ;1890 LENSFIELD(dF_ApR7) ;1891 LENSFIELD(sF_ApR7) ;1892 LENSFIELD(fF_ApR7) ;1893 1894 LENSFIELD(E1) ;1895 LENSFIELD(E2) ;1877 LENSFIELD(X11_sm_obj) 1878 LENSFIELD(X12_sm_obj) 1879 LENSFIELD(X22_sm_obj) 1880 LENSFIELD(E1_sm_obj) 1881 LENSFIELD(E2_sm_obj) 1882 1883 LENSFIELD(X11_sh_obj) 1884 LENSFIELD(X12_sh_obj) 1885 LENSFIELD(X22_sh_obj) 1886 LENSFIELD(E1_sh_obj) 1887 LENSFIELD(E2_sh_obj) 1888 1889 LENSFIELD(X11_sm_psf) 1890 LENSFIELD(X12_sm_psf) 1891 LENSFIELD(X22_sm_psf) 1892 LENSFIELD(E1_sm_psf) 1893 LENSFIELD(E2_sm_psf) 1894 1895 LENSFIELD(X11_sh_psf) 1896 LENSFIELD(X12_sh_psf) 1897 LENSFIELD(X22_sh_psf) 1898 LENSFIELD(E1_sh_psf) 1899 LENSFIELD(E2_sh_psf) 1900 1901 LENSFIELD( F_ApR5) 1902 LENSFIELD(dF_ApR5) 1903 LENSFIELD(sF_ApR5) 1904 LENSFIELD(fF_ApR5) 1905 1906 LENSFIELD( F_ApR6) 1907 LENSFIELD(dF_ApR6) 1908 LENSFIELD(sF_ApR6) 1909 LENSFIELD(fF_ApR6) 1910 1911 LENSFIELD( F_ApR7) 1912 LENSFIELD(dF_ApR7) 1913 LENSFIELD(sF_ApR7) 1914 LENSFIELD(fF_ApR7) 1915 1916 LENSFIELD(E1) 1917 LENSFIELD(E2) 1896 1918 1897 1919 # if (1) -
branches/eam_branches/ohana.20160226/src/libdvo/src/dvosorts.c
r36084 r39409 76 76 /* sort a coordinate pair (X,Y) and the associated index (S) */ 77 77 void sort_coords_indexonly (double *X, double *Y, off_t *S, off_t N) { 78 OHANA_UNUSED_PARAM(Y); 78 79 79 80 # define SWAPFUNC(A,B){ off_t itmp; \ -
branches/eam_branches/ohana.20160226/src/libfits/extern/gzip.c
r38986 r39409 122 122 123 123 z_stream stream; 124 int i,err;124 int err; 125 125 126 126 stream.next_in = (Bytef*)source; … … 140 140 if (EXTRA_VERBOSE) { 141 141 fprintf (stderr, "inp cmp: "); 142 unsigned long int i; 142 143 for (i = 0; i < sourceLen; i++) { 143 144 fprintf (stderr, "0x%02hhx ", source[i]); … … 165 166 if (EXTRA_VERBOSE) { 166 167 fprintf (stderr, "out cmp: "); 168 unsigned long int i; 167 169 for (i = 0; i < stream.total_out; i++) { 168 170 fprintf (stderr, "0x%02hhx ", dest[i]); … … 182 184 183 185 z_stream stream; 184 int i,err;186 int err; 185 187 186 188 stream.next_in = (Bytef*)source; … … 200 202 if (EXTRA_VERBOSE) { 201 203 fprintf (stderr, "inp unc: "); 204 unsigned long int i; 202 205 for (i = 0; i < sourceLen; i++) { 203 206 fprintf (stderr, "0x%02hhx ", source[i]); … … 226 229 if (EXTRA_VERBOSE) { 227 230 fprintf (stderr, "out unc: "); 231 unsigned long int i; 228 232 for (i = 0; i < stream.total_out; i++) { 229 233 fprintf (stderr, "0x%02hhx ", dest[i]); -
branches/eam_branches/ohana.20160226/src/libfits/header/F_write_H.c
r38553 r39409 25 25 myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory"); 26 26 myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory"); 27 myAssert (myBlock->size >= header[0].datasize, "overflow");27 myAssert (myBlock->size >= (size_t) header[0].datasize, "overflow"); 28 28 } 29 29 # endif -
branches/eam_branches/ohana.20160226/src/libfits/include/gfitsio.h
r39394 r39409 193 193 194 194 int gfits_uncompress_image PROTO((Header *header, Matrix *matrix, FTable *ftable)); 195 int gfits_uncompress_data PROTO((char *zdata, int Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, int *Nout,int Nout_alloc, int out_pixsize));196 int gfits_distribute_data PROTO((Matrix *matrix, char *data, int Ndata, int bitpix, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero));197 198 int gfits_compress_data PROTO((char *zdata, int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata,int Nraw, int raw_pixsize, int Nx, int Ny));199 int gfits_compress_image PROTO((Header *header, Matrix *matrix, FTable *ftable, int *Ztile, char *zcmptype));200 int gfits_collect_data PROTO((Matrix *matrix, char *raw, int Nraw, int raw_pixsize, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero));195 int gfits_uncompress_data PROTO((char *zdata, unsigned long int Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, unsigned long int *Nout, unsigned long int Nout_alloc, int out_pixsize)); 196 int gfits_distribute_data PROTO((Matrix *matrix, char *data, unsigned long int Ndata, int bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero)); 197 198 int gfits_compress_data PROTO((char *zdata, unsigned long int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata, unsigned long int Nraw, int raw_pixsize, int Nx, int Ny)); 199 int gfits_compress_image PROTO((Header *header, Matrix *matrix, FTable *ftable, unsigned long int *Ztile, char *zcmptype)); 200 int gfits_collect_data PROTO((Matrix *matrix, char *raw, unsigned long int Nraw, int raw_pixsize, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero)); 201 201 202 202 int gfits_copy_keywords_compress PROTO((Header *srchead, Header *tgthead)); 203 203 int gfits_swap_raw PROTO((Matrix *matrix)); 204 204 205 off_t gfits_tile_size PROTO((Matrix *matrix, int *otile, int *ztile));206 int gfits_imtile_maxsize PROTO((Matrix *matrix, int *ztile));207 int gfits_imtile_count PROTO((Matrix *matrix, int *ztile, int *ntile));205 off_t gfits_tile_size PROTO((Matrix *matrix, int *otile, unsigned long int *ztile)); 206 int gfits_imtile_maxsize PROTO((Matrix *matrix, unsigned long int *ztile)); 207 int gfits_imtile_count PROTO((Matrix *matrix, unsigned long int *ztile, int *ntile)); 208 208 int gfits_imtile_start PROTO((Matrix *matrix, int *otile)); 209 int gfits_imtile_next PROTO((Matrix *matrix, int *ztile, int *ntile, int *otile));209 int gfits_imtile_next PROTO((Matrix *matrix, unsigned long int *ztile, int *ntile, int *otile)); 210 210 211 211 int gfits_extension_is_compressed_image PROTO((Header *header)); 212 212 int gfits_extension_is_compressed_table PROTO((Header *header)); 213 int gfits_byteswap_zdata PROTO((char *zdata, int Nzdata, int pixsize));213 int gfits_byteswap_zdata PROTO((char *zdata, off_t Nzdata, int pixsize)); 214 214 int gfits_compressed_data_pixsize PROTO((char *cmptype, int out_bitpix, char **optname, char **optvalue, int Noptions)); 215 215 int gfits_uncompressed_data_pixsize PROTO((char *cmptype, int out_bitpix, char **optname, char **optvalue, int Noptions)); … … 279 279 int gfits_write_Theader PROTO((char *filename, Header *header)); 280 280 281 int gfits_compress_table PROTO((FTable *srctable, FTable *tgttable, int ztilelen, char *zcmptype));281 int gfits_compress_table PROTO((FTable *srctable, FTable *tgttable, unsigned long int ztilelen, char *zcmptype)); 282 282 int gfits_uncompress_table PROTO((FTable *srctable, FTable *tgttable)); 283 283 -
branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_M.c
r38441 r39409 4 4 # define VERBOSE_DUMP 0 5 5 6 int gfits_collect_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero);6 int gfits_collect_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero); 7 7 8 8 // the user needs to specify the various compression options: … … 23 23 # define ESCAPE { fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); goto escape; } 24 24 25 int gfits_compress_image (Header *header, Matrix *matrix, FTable *ftable, int *Ztile, char *zcmptype) {25 int gfits_compress_image (Header *header, Matrix *matrix, FTable *ftable, unsigned long int *Ztile, char *zcmptype) { 26 26 27 27 int i; … … 33 33 char *zdata = NULL; 34 34 35 int *ztile = Ztile;35 unsigned long int *ztile = Ztile; 36 36 37 37 Header *theader = ftable->header; … … 41 41 // determine the number of tiles (from ztile[] and image size) 42 42 if (!ztile) { 43 ALLOCATE (ztile, int, matrix->Naxes);43 ALLOCATE (ztile, unsigned long int, matrix->Naxes); 44 44 ztile[0] = matrix->Naxis[0]; 45 45 for (i = 1; i < matrix->Naxes; i++) ztile[i] = 1; … … 99 99 for (i = 0; i < header->Naxes; i++) { 100 100 snprintf (keyword, 10, "ZTILE%d", i + 1); 101 if (!gfits_modify (theader, keyword, "% d", 1, ztile[i])) ESCAPE;101 if (!gfits_modify (theader, keyword, "%lu", 1, ztile[i])) ESCAPE; 102 102 } 103 103 … … 157 157 158 158 // size (in pixels) of the largest tile 159 int max_tile_size = gfits_imtile_maxsize (matrix, ztile);159 unsigned long int max_tile_size = gfits_imtile_maxsize (matrix, ztile); 160 160 161 161 // size of a pixel in the raw pixel buffer (before compression) … … 179 179 180 180 // allocate the buffer for compression work 181 int Nzdata_alloc = raw_pixsize*max_tile_size + 100;181 unsigned long int Nzdata_alloc = raw_pixsize*max_tile_size + 100; 182 182 ALLOCATE (raw, char, raw_pixsize*max_tile_size); 183 183 ALLOCATE (zdata, char, Nzdata_alloc); … … 191 191 192 192 // size of the current tile in pixels 193 int Nraw = gfits_tile_size (matrix, otile, ztile);193 unsigned long int Nraw = gfits_tile_size (matrix, otile, ztile); 194 194 195 195 // copy the raw pixels from their native matrix locations to the temporary output buffer … … 216 216 if (!gfits_byteswap_zdata (raw, Nraw * raw_pixsize, raw_pixsize)) ESCAPE; 217 217 } 218 int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression218 unsigned long int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression 219 219 220 220 if (VERBOSE_DUMP && (i == 0)) { … … 223 223 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", raw[k]); if (k % 4 == 3) fprintf (stderr, " "); } 224 224 fprintf (stderr, "\n"); 225 fprintf (stderr, "Nzdata: % d-> ", Nzdata);225 fprintf (stderr, "Nzdata: %lu -> ", Nzdata); 226 226 } 227 227 … … 231 231 if (VERBOSE_DUMP && (i == 0)) { 232 232 int k; 233 fprintf (stderr, "% d\n", Nzdata);233 fprintf (stderr, "%lu\n", Nzdata); 234 234 fprintf (stderr, "cmp SWP: "); 235 235 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } … … 290 290 291 291 int gfits_copy_keywords_compress (Header *srchead, Header *tgthead) { 292 292 OHANA_UNUSED_PARAM(tgthead); 293 OHANA_UNUSED_PARAM(srchead); 294 295 # if (0) 293 296 int i; 294 297 295 298 for (i = 0; i < srchead->datasize; i += FT_LINE_LENGTH) { 296 299 } 300 # endif 301 297 302 return TRUE; 298 303 } … … 303 308 // * ztile gives the size of the i-th dimension of the current tile 304 309 // * raw_bitpix defines the size and type of the raw buffer 305 int gfits_collect_data (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero) {306 307 int i, j, start, offset, coord, Nline;308 int *counter = NULL;309 int *Ztile = NULL;310 311 ALLOCATE (counter, int, matrix->Naxes); // counter for current row in tile to copy312 ALLOCATE (Ztile, int, matrix->Naxes); // true sizes of this tile (in pixels)310 int gfits_collect_data (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) { 311 312 int i, k, start, offset, coord, Nline; 313 unsigned int *counter = NULL; 314 unsigned long int *Ztile = NULL; 315 316 ALLOCATE (counter, unsigned int, matrix->Naxes); // counter for current row in tile to copy 317 ALLOCATE (Ztile, unsigned long int, matrix->Naxes); // true sizes of this tile (in pixels) 313 318 314 319 for (i = 0; i < matrix->Naxes; i++) { … … 343 348 // this macro is used at the inner switch to run the actual loop 344 349 # define SCALE_AND_DIST_INT_PRINT(TYPE, SIZE, INTYPE) { \ 350 unsigned long int j; \ 345 351 TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)]; \ 346 352 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 356 362 // this macro is used at the inner switch to run the actual loop 357 363 # define SCALE_AND_DIST_INT(OTYPE, OSIZE) { \ 364 unsigned long int j; \ 358 365 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 359 366 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 370 377 // this macro is used at the inner switch to run the actual loop 371 378 # define SCALE_AND_DIST_FLOAT(OTYPE, OSIZE) { \ 379 unsigned long int j; \ 372 380 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 373 381 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 419 427 420 428 // update the counters, carrying to the next dimension if needed 421 for ( j = 1; j < matrix->Naxes; j++) {422 counter[ j] ++;423 if (counter[ j] == Ztile[j]) {424 counter[ j] = 0;429 for (k = 1; k < matrix->Naxes; k++) { 430 counter[k] ++; 431 if (counter[k] == Ztile[k]) { 432 counter[k] = 0; 425 433 } else { 426 434 break; 427 435 } 428 436 } 429 if ( j== matrix->Naxes) assert (i == Nline - 1); // we should be done here...437 if (k == matrix->Naxes) assert (i == Nline - 1); // we should be done here... 430 438 431 439 // Naxes = 3 … … 435 443 // determine the offset of the next line relative to the start position 436 444 offset = counter[matrix->Naxes - 1]; 437 for ( j = matrix->Naxes - 2; j >= 0; j--) {438 offset = offset*matrix->Naxis[ j] + counter[j];445 for (k = matrix->Naxes - 2; k >= 0; k--) { 446 offset = offset*matrix->Naxis[k] + counter[k]; 439 447 } 440 448 } … … 453 461 // * ztile gives the size of the i-th dimension of the current tile 454 462 // * raw_bitpix defines the size and type of the raw buffer 455 int gfits_collect_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero) { 456 457 int i, j, k; 458 int *counter = NULL; 459 int *Ztile = NULL; 460 461 ALLOCATE (counter, int, matrix->Naxes); // counter for current row in tile to copy 462 ALLOCATE (Ztile, int, matrix->Naxes); // true sizes of this tile (in pixels) 463 int gfits_collect_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) { 464 OHANA_UNUSED_PARAM(oblank); 465 OHANA_UNUSED_PARAM(zblank); 466 OHANA_UNUSED_PARAM(zzero); 467 OHANA_UNUSED_PARAM(zscale); 468 469 unsigned long int i, j; 470 unsigned int *counter = NULL; 471 unsigned long int *Ztile = NULL; 472 473 ALLOCATE (counter, unsigned int, matrix->Naxes); // counter for current row in tile to copy 474 ALLOCATE (Ztile, unsigned long int, matrix->Naxes); // true sizes of this tile (in pixels) 463 475 464 for (i = 0; i < matrix->Naxes; i++) { 465 counter[i] = 0; 466 Ztile[i] = MIN ((matrix->Naxis[i] - otile[i]*ztile[i]), ztile[i]); 476 int k; 477 for (k = 0; k < matrix->Naxes; k++) { 478 counter[k] = 0; 479 Ztile[k] = MIN ((matrix->Naxis[k] - otile[k]*ztile[k]), ztile[k]); 467 480 } 468 481 469 482 // number of lines in the tile (in pixels) 470 int Nline = 1;471 int Npix = matrix->Naxis[0];472 for ( i = 1; i < matrix->Naxes; i++) {473 Nline *= Ztile[ i];474 Npix *= matrix->Naxis[ i];483 unsigned long int Nline = 1; 484 unsigned long int Npix = matrix->Naxis[0]; 485 for (k = 1; k < matrix->Naxes; k++) { 486 Nline *= Ztile[k]; 487 Npix *= matrix->Naxis[k]; 475 488 } 476 489 … … 482 495 // start = otile[0]*ztile[0] + Naxis[0]*(otile[1]*ztile[1] + Naxis[1]*(otile[2]*ztile[2] + ...)); 483 496 int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1]; 484 for ( i = matrix->Naxes - 2; i >= 0; i--) {485 int coord = otile[i]*ztile[i];486 start = start*matrix->Naxis[ i] + coord;497 for (k = matrix->Naxes - 2; k >= 0; k--) { 498 unsigned long int coord = otile[k]*ztile[k]; 499 start = start*matrix->Naxis[k] + coord; 487 500 } 488 501 … … 519 532 520 533 // update the counters, carrying to the next dimension if needed 521 for (j = 1; j < matrix->Naxes; j++) { 522 counter[j] ++; 523 if (counter[j] == Ztile[j]) { 524 counter[j] = 0; 534 int axis; 535 for (axis = 1; axis < matrix->Naxes; axis++) { 536 counter[axis] ++; 537 if (counter[axis] == Ztile[axis]) { 538 counter[axis] = 0; 525 539 } else { 526 540 break; 527 541 } 528 542 } 529 if ( j== matrix->Naxes) assert (i == Nline - 1); // we should be done here...543 if (axis == matrix->Naxes) assert (i == Nline - 1); // we should be done here... 530 544 531 545 // Naxes = 3 … … 535 549 // determine the offset of the next line relative to the start position 536 550 offset = counter[matrix->Naxes - 1]; 537 for ( j = matrix->Naxes - 2; j >= 0; j--) {538 offset = offset*matrix->Naxis[ j] + counter[j];551 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 552 offset = offset*matrix->Naxis[axis] + counter[axis]; 539 553 } 540 554 } -
branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_data.c
r38986 r39409 2 2 # include <gfitsio.h> 3 3 # include <zlib.h> 4 5 /* functions defined in ricecomp.c */ 6 int fits_rcomp(int a[], int nx, unsigned char *c, int clen, int nblock); 7 int fits_rcomp_short(short a[], int nx, unsigned char *c, int clen, int nblock); 8 int fits_rcomp_byte(char a[], int nx, unsigned char *c, int clen, int nblock); 9 int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock); 10 int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock); 11 int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock); 12 13 /* functions defined in fits_hcompress.c */ 14 # define LONGLONG long long 15 int fits_hcompress(int *a, int ny, int nx, int scale, char *output, long *nbytes, int *status); 16 int fits_hcompress64(LONGLONG *a, int ny, int nx, int scale, char *output, long *nbytes, int *status); 17 18 /* functions defined in fits_hdeccompress.c */ 19 int fits_hdecompress(unsigned char *input, int smooth, int *a, int *ny, int *nx, int *scale, int *status); 20 int fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *ny, int *nx, int *scale, int *status); 21 22 /* functions defined in pliocomp.c */ 23 int pl_p2li (int *pxsrc, int xs, short *lldst, int npix); 24 int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix); 25 26 /* functions defined in gzip.c */ 27 int gfits_gz_stripheader (unsigned char *data, int *ndata); 28 int gfits_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); 29 int gfits_compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); 4 # include <gfits_compress.h> 30 5 31 6 # define ESCAPE(RET) { fprintf (stderr, "gzip error in %s @ %s:%d\n", __func__, __FILE__, __LINE__); return (RET); } … … 33 8 // XXX I'm putting Nx and Ny on the argument list -- only used by hcompress 34 9 // with a little work, these could go on the option list 35 int gfits_compress_data (char *zdata, int *Nzdata, char *cmptype, 36 char **optname, char **optvalue, int Nopt, 37 char *rawdata, int Nrawpix, int rawpix_size, 38 int Nx, int Ny) { 10 int gfits_compress_data (char *zdata, unsigned long int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata, unsigned long int Nrawpix, int rawpix_size, int Nx, int Ny) { 39 11 40 int Nout;41 12 int status; 42 13 … … 68 39 69 40 if (!strcasecmp(cmptype, "RICE_1") || !strcasecmp(cmptype, "RICE_ONE")) { 41 long int Nout; 70 42 int i, blocksize; 71 43 // look for the BLOCKSIZE … … 85 57 // fprintf (stderr, "%d comp bytes; %d uncomp 'pixels', totals: %d %d\n", Nzdata, Npix, Ninsum, Noutsum); 86 58 87 int k;88 89 59 switch (rawpix_size) { 90 60 case 4: … … 98 68 99 69 if (0) { 100 fprintf (stderr, "Nout: %d, Nrawpix: %d\n", Nout, Nrawpix); 70 long int k; 71 fprintf (stderr, "Nout: %lu, Nrawpix: %lu\n", Nout, Nrawpix); 101 72 fprintf (stderr, "cmp inp: "); 102 73 for (k = 0; k < Nout; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 2) fprintf (stderr, " "); } … … 119 90 return (FALSE); 120 91 } 121 if (Nout > *Nzdata) {122 fprintf (stderr, "buffer overrun! % d out, %davailable\n", Nout, *Nzdata);92 if (Nout > (long int) *Nzdata) { 93 fprintf (stderr, "buffer overrun! %ld out, %lu available\n", Nout, *Nzdata); 123 94 return FALSE; 124 95 } 125 *Nzdata = Nout;96 *Nzdata = (unsigned long int) Nout; 126 97 return TRUE; 127 98 } … … 129 100 if (!strcasecmp(cmptype, "PLIO_1")) { 130 101 // note the fortan starting point: zdata is decremented at start 131 Nout = pl_p2li ((int *) rawdata, 1, (short *) zdata, Nrawpix);102 int Nout = pl_p2li ((int *) rawdata, 1, (short *) zdata, Nrawpix); 132 103 *Nzdata = Nout; 133 104 if (!Nout) return (FALSE); -
branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_utils.c
r38441 r39409 17 17 18 18 typedef struct { 19 int *ztile; // max size of a tile (edge tiles may be smaller)19 unsigned long int *ztile; // max size of a tile (edge tiles may be smaller) 20 20 int *otile; // counter for current tile (eg, for (2,3,0) otile[0] = 2, otile[1] = 3, otile[2] = 0) 21 21 int *ntile; // number of tiles in dimension [i] … … 23 23 24 24 // advance the otile counter. 25 int gfits_imtile_next (Matrix *matrix, int *ztile, int *ntile, int *otile) { 25 int gfits_imtile_next (Matrix *matrix, unsigned long int *ztile, int *ntile, int *otile) { 26 OHANA_UNUSED_PARAM(ztile); 26 27 27 28 int i; … … 53 54 54 55 // how many tiles needed for this image (given ztile[]) 55 int gfits_imtile_count (Matrix *matrix, int *ztile, int *ntile) {56 int gfits_imtile_count (Matrix *matrix, unsigned long int *ztile, int *ntile) { 56 57 57 58 int i; … … 67 68 68 69 // how many tiles needed for this image (given ztile[]) 69 int gfits_imtile_maxsize (Matrix *matrix, int *ztile) {70 int gfits_imtile_maxsize (Matrix *matrix, unsigned long int *ztile) { 70 71 71 72 int i; 72 73 73 int max_tile_size = 1;74 unsigned long int max_tile_size = 1; 74 75 for (i = 0; i < matrix->Naxes; i++) { 75 76 max_tile_size *= ztile[i]; … … 80 81 81 82 // true sizes of this tile (in pixels) 82 off_t gfits_tile_size (Matrix *matrix, int *otile, int *ztile) {83 off_t gfits_tile_size (Matrix *matrix, int *otile, unsigned long int *ztile) { 83 84 84 85 off_t i, Npixels, Ndimen; … … 93 94 } 94 95 95 int gfits_byteswap_zdata (char *zdata, int Nzdata, int pixsize) {96 int gfits_byteswap_zdata (char *zdata, off_t Nzdata, int pixsize) { 96 97 97 98 # define DOSWAP(A,B) { char tmp = A; A = B; B = tmp; } … … 99 100 # ifdef BYTE_SWAP 100 101 101 int i;102 off_t i; 102 103 103 104 // fprintf (stderr, "swapping %d bytes in pix of size %d bytes...\n", Nzdata, pixsize); -
branches/eam_branches/ohana.20160226/src/libfits/matrix/F_convert_format.c
r38062 r39409 19 19 in = (inMode *) matrix[0].buffer; \ 20 20 for (i = 0; i < Npixels; i++, out++, in++) \ 21 if (*in == inBlank) {\21 if (*in == (inMode) inBlank) { \ 22 22 *out = (MY_NAN); \ 23 23 } else { \ … … 32 32 in = (inMode *) matrix[0].buffer; \ 33 33 for (i = 0; i < Npixels; i++, out++, in++) \ 34 if (*in == inBlank) { \34 if (*in == (inMode) inBlank) { \ 35 35 *out = (MY_NAN); \ 36 36 } else { \ … … 45 45 in = (inMode *)matrix[0].buffer + Npixels - 1; \ 46 46 for (i = 0; i < Npixels; i++, out--, in--) \ 47 if (*in == inBlank) { \47 if (*in == (inMode) inBlank) { \ 48 48 *out = (MY_NAN); \ 49 49 } else { \ -
branches/eam_branches/ohana.20160226/src/libfits/matrix/F_uncompress_M.c
r38989 r39409 4 4 # define VERBOSE_DUMP 0 5 5 6 int gfits_distribute_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero); 7 8 # define ESCAPE { \ 9 fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); \ 10 if (ztile != NULL) free (ztile); \ 11 if (optname != NULL) { \ 12 for (j = 0; j < Noptions; j++) { \ 13 free (optname[j]); \ 14 free (optvalue[j]); \ 15 } \ 16 free (optname); \ 17 free (optvalue); \ 18 } \ 19 if (out != NULL) free (out); \ 20 if (otile != NULL) free (otile); \ 21 if (ntile != NULL) free (ntile); \ 22 return (FALSE); } 23 24 # define MOD_KEYWORD(ZNAME,NAME,TYPE,IN,OUT) { \ 6 int gfits_distribute_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero); 7 8 # define ESCAPE { \ 9 fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); \ 10 if (ztile != NULL) free (ztile); \ 11 if (optname != NULL) { \ 12 int opt; \ 13 for (opt = 0; opt < Noptions; opt++) { \ 14 free (optname[opt]); \ 15 free (optvalue[opt]); \ 16 } \ 17 free (optname); \ 18 free (optvalue); \ 19 } \ 20 if (out != NULL) free (out); \ 21 if (otile != NULL) free (otile); \ 22 if (ntile != NULL) free (ntile); \ 23 return (FALSE); } 24 25 # define MOD_KEYWORD(ZNAME,NAME,TYPE,IN,OUT) { \ 25 26 if (gfits_scan (header, ZNAME, TYPE, 1, IN)) { \ 26 gfits_modify (header, NAME, TYPE, 1, OUT); \27 } \27 gfits_modify (header, NAME, TYPE, 1, OUT); \ 28 } \ 28 29 gfits_delete (header, ZNAME, 1); } 29 30 30 # define MOD_KEYWORD_ALT(ZNAME,NAME,TYPE,IN,OUT) { \31 # define MOD_KEYWORD_ALT(ZNAME,NAME,TYPE,IN,OUT) { \ 31 32 if (gfits_scan_alt (header, ZNAME, TYPE, 1, IN)) { \ 32 gfits_modify_alt (header, NAME, TYPE, 1, OUT); \33 } \33 gfits_modify_alt (header, NAME, TYPE, 1, OUT); \ 34 } \ 34 35 gfits_delete (header, ZNAME, 1); } 35 36 36 # define MOD_KEYWORD_REQUIRED(ZNAME,NAME,TYPE,IN,OUT) { \37 if (!gfits_scan (header, ZNAME, TYPE, 1, IN)) ESCAPE;\38 gfits_delete (header, ZNAME, 1);\39 gfits_modify (header, NAME, TYPE, 1, OUT); }37 # define MOD_KEYWORD_REQUIRED(ZNAME,NAME,TYPE,IN,OUT) { \ 38 if (!gfits_scan (header, ZNAME, TYPE, 1, IN)) ESCAPE; \ 39 gfits_delete (header, ZNAME, 1); \ 40 gfits_modify (header, NAME, TYPE, 1, OUT); } 40 41 41 42 int gfits_uncompress_image (Header *header, Matrix *matrix, FTable *ftable) { 42 43 44 int status, zimage; 43 45 off_t Nzdata, Nzrows, zcol; 44 int i, j, status, zimage, Nout,max_tile_size;46 unsigned long int max_tile_size; 45 47 char cmptype[80]; 46 48 char zaxis[10], naxis[10], key[10], word[81], exttype[81], checksum[81], datasum[81]; … … 49 51 float zscale, zzero; 50 52 51 int *ztile = NULL;53 unsigned long int *ztile = NULL; 52 54 int *otile = NULL; 53 55 int *ntile = NULL; … … 77 79 MOD_KEYWORD_REQUIRED ("ZNAXIS", "NAXIS", "%d", &header->Naxes, header->Naxes); 78 80 79 for (i = 0; i < header->Naxes; i++) { 80 snprintf (zaxis, 10, "ZNAXIS%d", i + 1); 81 snprintf (naxis, 10, "NAXIS%d", i + 1); 82 MOD_KEYWORD_REQUIRED (zaxis, naxis, OFF_T_FMT, &header->Naxis[i], header->Naxis[i]); 81 int axis; 82 for (axis = 0; axis < header->Naxes; axis++) { 83 snprintf (zaxis, 10, "ZNAXIS%d", axis + 1); 84 snprintf (naxis, 10, "NAXIS%d", axis + 1); 85 MOD_KEYWORD_REQUIRED (zaxis, naxis, OFF_T_FMT, &header->Naxis[axis], header->Naxis[axis]); 83 86 } 84 87 … … 86 89 // the actual tile size may be smaller at the edge of a dimension. if the ZTILEn 87 90 // entries are not found, default to [Nx,1,1,...] 88 ALLOCATE (ztile, int, header->Naxes);89 if (!gfits_scan (header, "ZTILE1", "% d", 1, &ztile[0])) {91 ALLOCATE (ztile, unsigned long int, header->Naxes); 92 if (!gfits_scan (header, "ZTILE1", "%lu", 1, &ztile[0])) { 90 93 ztile[0] = header->Naxis[0]; 91 for ( i = 1; i < header->Naxes; i++) {92 ztile[ i] = 1;94 for (axis = 1; axis < header->Naxes; axis++) { 95 ztile[axis] = 1; 93 96 } 94 97 } else { 95 98 gfits_delete (header, "ZTILE1", 1); 96 for ( i = 1; i < header->Naxes; i++) {97 snprintf (key, 10, "ZTILE%d", i+ 1);98 if (!gfits_scan (header, key, "% d", 1, &ztile[i])) ESCAPE;99 for (axis = 1; axis < header->Naxes; axis++) { 100 snprintf (key, 10, "ZTILE%d", axis + 1); 101 if (!gfits_scan (header, key, "%lu", 1, &ztile[axis])) ESCAPE; 99 102 gfits_delete (header, key, 1); 100 103 } … … 199 202 // find the COMPRESSED_DATA column (format should be 1PB, 1PI, 1PJ) 200 203 // is it required that this be the only column? 201 for (i = 1; TRUE; i++) { 202 snprintf (key, 10, "TTYPE%d", i); 204 int colnum; 205 for (colnum = 1; TRUE; colnum++) { 206 snprintf (key, 10, "TTYPE%d", colnum); 203 207 if (!gfits_scan (ftable->header, key, "%s", 1, word)) ESCAPE; 204 208 if (!strcmp (word, "COMPRESSED_DATA")) break; 205 209 } 206 zcol = i;210 zcol = colnum; 207 211 208 212 if (!gfits_varlength_column_define (ftable, &zdef, zcol)) ESCAPE; … … 220 224 ALLOCATE (ntile, int, matrix->Naxes); 221 225 max_tile_size = 1; 222 for ( i = 0; i < matrix->Naxes; i++) {223 otile[ i] = 0;224 ntile[ i] = (matrix->Naxis[i] % ztile[i]) ? (matrix->Naxis[i] / ztile[i] + 1) : (matrix->Naxis[i] / ztile[i]);225 max_tile_size *= ztile[ i];226 227 // ztile[ i] is the default (or max) tile size in the i-th dimension228 // ntile[ i] is the number of tiles in the i-th dimension229 // otile[ i] is the current output tile counter in the i-th dimension226 for (axis = 0; axis < matrix->Naxes; axis++) { 227 otile[axis] = 0; 228 ntile[axis] = (matrix->Naxis[axis] % ztile[axis]) ? (matrix->Naxis[axis] / ztile[axis] + 1) : (matrix->Naxis[axis] / ztile[axis]); 229 max_tile_size *= ztile[axis]; 230 231 // ztile[axis] is the default (or max) tile size in the i-th dimension 232 // ntile[axis] is the number of tiles in the i-th dimension 233 // otile[axis] is the current output tile counter in the i-th dimension 230 234 } 231 235 … … 254 258 // fprintf (stderr, "raw_pixsize: %d, cmp_pixsize: %d, tile_pixsize: %d, raw_bitpix: %d\n", raw_pixsize, cmp_pixsize, tile_pixsize, raw_bitpix); 255 259 256 int Nout_alloc = raw_pixsize*max_tile_size;260 unsigned long int Nout_alloc = raw_pixsize*max_tile_size; 257 261 ALLOCATE (out, char, Nout_alloc); 258 262 … … 271 275 272 276 // expected output size for this tile 273 Nout = raw_pixsize*gfits_tile_size (matrix, otile, ztile);277 unsigned long Nout = raw_pixsize*gfits_tile_size (matrix, otile, ztile); 274 278 275 279 zdata = gfits_varlength_column_pointer (ftable, &zdef, row, &Nzdata); … … 297 301 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 298 302 fprintf (stderr, "\n"); 299 fprintf (stderr, "Nout : % d-> ", Nout);303 fprintf (stderr, "Nout : %lu -> ", Nout); 300 304 } 301 305 … … 307 311 if (VERBOSE_DUMP && (row == 0)) { 308 312 int k; 309 fprintf (stderr, "% d\n", Nout);313 fprintf (stderr, "%lu\n", Nout); 310 314 fprintf (stderr, "unc swp: "); 311 315 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", out[k]); if (k % 4 == 3) fprintf (stderr, " "); } … … 315 319 if (!strcasecmp(cmptype, "GZIP_1")) { 316 320 // Nout is number of pixels 317 if (!gfits_byteswap_zdata (out, Nout * raw_pixsize, raw_pixsize)) ESCAPE;321 if (!gfits_byteswap_zdata (out, (off_t) (Nout * raw_pixsize), raw_pixsize)) ESCAPE; 318 322 } 319 323 … … 340 344 341 345 // update the tile counters, carrying to the next dimension if needed 342 for ( j = 0; j < matrix->Naxes; j++) {343 otile[ j] ++;344 if (otile[ j] == ntile[j]) {345 otile[ j] = 0;346 for (axis = 0; axis < matrix->Naxes; axis++) { 347 otile[axis] ++; 348 if (otile[axis] == ntile[axis]) { 349 otile[axis] = 0; 346 350 } else { 347 351 break; … … 352 356 FREE (ztile); 353 357 if (optname != NULL) { 354 for (j = 0; j < Noptions; j++) { 355 FREE (optname[j]); 356 FREE (optvalue[j]); 358 int opt; 359 for (opt = 0; opt < Noptions; opt++) { 360 FREE (optname[opt]); 361 FREE (optvalue[opt]); 357 362 } 358 363 FREE (optname); … … 366 371 367 372 // bitpix is the input data size/type 368 int gfits_distribute_data (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero) {369 370 int i, j;371 int *counter = NULL;372 int *Ztile = NULL;373 374 ALLOCATE (counter, int, matrix->Naxes);375 ALLOCATE (Ztile, int, matrix->Naxes);373 int gfits_distribute_data (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) { 374 375 int axis; 376 unsigned int *counter = NULL; 377 unsigned long int *Ztile = NULL; 378 379 ALLOCATE (counter, unsigned int, matrix->Naxes); 380 ALLOCATE (Ztile, unsigned long int, matrix->Naxes); 376 381 377 382 // counter for current row in tile to copy 378 383 // true sizes of this tile (in pixels) 379 for ( i = 0; i < matrix->Naxes; i++) {380 counter[ i] = 0;381 Ztile[ i] = MIN ((matrix->Naxis[i] - otile[i]*ztile[i]), ztile[i]);384 for (axis = 0; axis < matrix->Naxes; axis++) { 385 counter[axis] = 0; 386 Ztile[axis] = MIN ((matrix->Naxis[axis] - otile[axis]*ztile[axis]), ztile[axis]); 382 387 } 383 388 384 389 // number of lines in the tile (in pixels) 385 int Nline = 1;386 for ( i = 1; i < matrix->Naxes; i++) {387 Nline *= Ztile[ i];390 unsigned long int Nline = 1; 391 for (axis = 1; axis < matrix->Naxes; axis++) { 392 Nline *= Ztile[axis]; 388 393 } 389 394 … … 394 399 // start = otile[0]*ztile[0] + otile[1]*ztile[1]*Naxis[0] + otile[2]*ztile[2]*Naxis[0]*Naxis[1] + ...; 395 400 // start = otile[0]*ztile[0] + Naxis[0]*(otile[1]*ztile[1] + Naxis[1]*(otile[2]*ztile[2] + ...)); 396 int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1];397 for ( i = matrix->Naxes - 2; i >= 0; i--) {398 int coord = otile[i]*ztile[i];399 start = start*matrix->Naxis[ i] + coord;401 unsigned long int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1]; 402 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 403 unsigned long int coord = otile[axis]*ztile[axis]; 404 start = start*matrix->Naxis[axis] + coord; 400 405 } 401 406 402 407 // pixel offset in output array relative to tile start 403 int offset = 0;408 unsigned long int offset = 0; 404 409 405 410 int directCopy = (zzero == 0.0) && (zscale == 1.0); 406 411 407 412 # define SCALE_AND_DIST_INT_PRINT(TYPE, SIZE) { \ 413 unsigned long j; \ 408 414 TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)]; \ 409 415 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 418 424 // this macro is used at the inner switch to run the actual loop 419 425 # define SCALE_AND_DIST_INT(OTYPE, OSIZE) { \ 426 unsigned long j; \ 420 427 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 421 428 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 432 439 // this macro is used at the inner switch to run the actual loop 433 440 # define SCALE_AND_DIST_FLOAT(OTYPE, OSIZE) { \ 441 unsigned long j; \ 434 442 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 435 443 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 461 469 case 8: SCALE_AND_DIST_INT (char, 1); break; \ 462 470 case 16: SCALE_AND_DIST_INT (short, 2); break; \ 463 case 32: SCALE_AND_DIST_INT (int, 4); break; \471 case 32: SCALE_AND_DIST_INT (int, 4); break; \ 464 472 case -32: SCALE_AND_DIST_FLOAT (float, 4); break; \ 465 473 case -64: SCALE_AND_DIST_FLOAT (double, 8); break; \ … … 468 476 469 477 // loop over lines in the tile 478 unsigned long int i; 470 479 for (i = 0; i < Nline; i++) { 471 480 switch (raw_bitpix) { … … 479 488 480 489 // update the counters, carrying to the next dimension if needed 481 for ( j = 1; j < matrix->Naxes; j++) {482 counter[ j] ++;483 if (counter[ j] == Ztile[j]) {484 counter[ j] = 0;490 for (axis = 1; axis < matrix->Naxes; axis++) { 491 counter[axis] ++; 492 if (counter[axis] == Ztile[axis]) { 493 counter[axis] = 0; 485 494 } else { 486 495 break; 487 496 } 488 497 } 489 if ( j== matrix->Naxes) assert (i == Nline - 1); // we should be done here...498 if (axis == matrix->Naxes) assert (i == Nline - 1); // we should be done here... 490 499 491 500 // Naxes = 3 … … 495 504 // determine the offset of the next line relative to the start position 496 505 offset = counter[matrix->Naxes - 1]; 497 for ( j = matrix->Naxes - 2; j >= 0; j--) {498 offset = offset*matrix->Naxis[ j] + counter[j];506 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 507 offset = offset*matrix->Naxis[axis] + counter[axis]; 499 508 } 500 509 } … … 506 515 507 516 // bitpix is the input data size/type 508 int gfits_distribute_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero) { 509 510 int i, j, k; 511 int *counter = NULL; 512 int *Ztile = NULL; 513 514 ALLOCATE (counter, int, matrix->Naxes); 515 ALLOCATE (Ztile, int, matrix->Naxes); 517 int gfits_distribute_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) { 518 OHANA_UNUSED_PARAM(oblank); 519 OHANA_UNUSED_PARAM(zblank); 520 OHANA_UNUSED_PARAM(zzero); 521 OHANA_UNUSED_PARAM(zscale); 522 523 int axis; 524 unsigned int *counter = NULL; 525 unsigned long int *Ztile = NULL; 526 527 ALLOCATE (counter, unsigned int, matrix->Naxes); 528 ALLOCATE (Ztile, unsigned long int, matrix->Naxes); 516 529 517 530 // counter for current row in tile to copy 518 531 // true sizes of this tile (in pixels) 519 for ( i = 0; i < matrix->Naxes; i++) {520 counter[ i] = 0;521 Ztile[ i] = MIN ((matrix->Naxis[i] - otile[i]*ztile[i]), ztile[i]);532 for (axis = 0; axis < matrix->Naxes; axis++) { 533 counter[axis] = 0; 534 Ztile[axis] = MIN ((matrix->Naxis[axis] - otile[axis]*ztile[axis]), ztile[axis]); 522 535 } 523 536 524 537 // number of lines in the tile (in pixels) 525 int Nline = 1;526 int Npix = matrix->Naxis[0];527 for ( i = 1; i < matrix->Naxes; i++) {528 Nline *= Ztile[ i];529 Npix *= matrix->Naxis[ i];538 unsigned long int Nline = 1; 539 unsigned long int Npix = matrix->Naxis[0]; 540 for (axis = 1; axis < matrix->Naxes; axis++) { 541 Nline *= Ztile[axis]; 542 Npix *= matrix->Naxis[axis]; 530 543 } 531 544 … … 536 549 // start = otile[0]*ztile[0] + otile[1]*ztile[1]*Naxis[0] + otile[2]*ztile[2]*Naxis[0]*Naxis[1] + ...; 537 550 // start = otile[0]*ztile[0] + Naxis[0]*(otile[1]*ztile[1] + Naxis[1]*(otile[2]*ztile[2] + ...)); 538 int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1];539 for ( i = matrix->Naxes - 2; i >= 0; i--) {540 int coord = otile[i]*ztile[i];541 start = start*matrix->Naxis[ i] + coord;551 unsigned long int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1]; 552 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 553 unsigned long int coord = otile[axis]*ztile[axis]; 554 start = start*matrix->Naxis[axis] + coord; 542 555 } 543 556 … … 553 566 554 567 // pixel offset in output array relative to tile start 555 int offset = 0;568 unsigned long int offset = 0; 556 569 557 570 static int pass = 0; 571 int k; 558 572 for (k = 0; k < size; k++) { 573 unsigned long int i; 559 574 for (i = 0; i < Nline; i++) { 560 575 # ifdef BYTE_SWAP … … 564 579 # endif 565 580 char *rawptr = &raw[i*Ztile[0] + k*Nraw]; 581 unsigned long j; 566 582 for (j = 0; j < Ztile[0]; j++, srcptr += size, rawptr ++) { 567 583 if (FALSE && (i == 0) && (j < 4) && (pass == 0)) { … … 574 590 575 591 // update the counters, carrying to the next dimension if needed 576 for ( j = 1; j < matrix->Naxes; j++) {577 counter[ j] ++;578 if (counter[ j] == Ztile[j]) {579 counter[ j] = 0;592 for (axis = 1; axis < matrix->Naxes; axis++) { 593 counter[axis] ++; 594 if (counter[axis] == Ztile[axis]) { 595 counter[axis] = 0; 580 596 } else { 581 597 break; 582 598 } 583 599 } 584 if ( j== matrix->Naxes) assert (i == Nline - 1); // we should be done here...600 if (axis == matrix->Naxes) assert (i == Nline - 1); // we should be done here... 585 601 586 602 // Naxes = 3 … … 590 606 // determine the offset of the next line relative to the start position 591 607 offset = counter[matrix->Naxes - 1]; 592 for ( j = matrix->Naxes - 2; j >= 0; j--) {593 offset = offset*matrix->Naxis[ j] + counter[j];608 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 609 offset = offset*matrix->Naxis[axis] + counter[axis]; 594 610 } 595 611 } -
branches/eam_branches/ohana.20160226/src/libfits/matrix/F_uncompress_data.c
r38441 r39409 2 2 # include <gfitsio.h> 3 3 # include <zlib.h> 4 5 /* functions defined in ricecomp.c */ 6 int fits_rcomp(int a[], int nx, unsigned char *c, int clen, int nblock); 7 int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock); 8 int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock); 9 int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock); 10 11 /* functions defined in fits_hcompress.c */ 12 # define LONGLONG long long 13 int fits_hcompress(int *a, int ny, int nx, int scale, char *output, long *nbytes, int *status); 14 int fits_hcompress64(LONGLONG *a, int ny, int nx, int scale, char *output, long *nbytes, int *status); 15 16 /* functions defined in fits_hdeccompress.c */ 17 int fits_hdecompress(unsigned char *input, int smooth, int *a, int *ny, int *nx, int *scale, int *status); 18 int fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *ny, int *nx, int *scale, int *status); 19 20 /* functions defined in pliocomp.c */ 21 int pl_p2li (int *pxsrc, int xs, short *lldst, int npix); 22 int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix); 23 24 /* functions defined in gzip.c */ 25 int gfits_gz_stripheader (unsigned char *data, int *ndata); 26 int gfits_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); 4 # include <gfits_compress.h> 27 5 28 6 # define ESCAPE(RET) { fprintf (stderr, "gzip error in %s @ %s:%d\n", __func__, __FILE__, __LINE__); return (RET); } 29 7 30 int gfits_uncompress_data (char *zdata, int Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, int *Nout,int Nout_alloc, int out_pixsize) {8 int gfits_uncompress_data (char *zdata, unsigned long Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, unsigned long int *Nout, unsigned long int Nout_alloc, int out_pixsize) { 31 9 32 10 int status; … … 78 56 79 57 int status = FALSE; 80 int Npix = *Nout / out_pixsize; 81 int k; 58 unsigned long int Npix = *Nout / out_pixsize; 82 59 83 60 switch (out_pixsize) { … … 88 65 case 2: 89 66 if (0) { 90 fprintf (stderr, "Nout: %d, Nrawpix: %d\n", Nzdata, Npix); 67 unsigned long int k; 68 fprintf (stderr, "Nout: %lu, Nrawpix: %lu\n", Nzdata, Npix); 91 69 fprintf (stderr, "cmp out: "); 92 70 for (k = 0; k < Nzdata; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); } … … 112 90 113 91 if (!strcasecmp(cmptype, "PLIO_1")) { 92 int Ntru = *Nout; 114 93 int Npix; 115 Npix = pl_l2pi ((short *) zdata, 1, (int *) outdata, *Nout);116 if (Npix != *Nout) {94 Npix = pl_l2pi ((short *) zdata, 1, (int *) outdata, Ntru); 95 if (Npix != Ntru) { 117 96 fprintf (stderr, "error in plio decompression\n"); 118 97 return (FALSE); … … 122 101 123 102 if (!strcasecmp(cmptype, "HCOMPRESS_1")) { 103 unsigned long int Ntru = *Nout; 124 104 int Nx, Ny, scale; 125 105 status = 0; … … 132 112 // fprintf (stderr, "decompression yields image %d x %d (scale: %d)\n", Nx, Ny, scale); 133 113 134 if (Nx * Ny != *Nout) { 114 unsigned long Npix = Nx * Ny; 115 if (Npix != Ntru) { 135 116 fprintf (stderr, "error in hdecompress: mismatched output size\n"); 136 117 return (FALSE); -
branches/eam_branches/ohana.20160226/src/libfits/table/F_compress_T.c
r39358 r39409 23 23 # define ESCAPE { fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); goto escape; } 24 24 25 int gfits_collect_table_data (FTable *table, TableField *field, char *raw, int row_start,int Nrows);26 int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, int row_start,int Nrows);25 int gfits_collect_table_data (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows); 26 int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows); 27 27 28 28 static float timeSum1 = 0.0; … … 51 51 } 52 52 53 int gfits_compress_table (FTable *srctable, FTable *tgttable, int ztilelen, char *zcmptype) { 54 55 int i, j; 53 int gfits_compress_table (FTable *srctable, FTable *tgttable, unsigned long int ztilelen, char *zcmptype) { 56 54 57 55 char keyword[81]; … … 69 67 gettimeofday (&startTimer, (void *) NULL); 70 68 71 int Ntile, ztilelast;69 unsigned long int Ntile, ztilelast; 72 70 if (!ztilelen) ztilelen = srcheader->Naxis[1]; 73 71 … … 104 102 105 103 ALLOCATE_ZERO (fields, TableField, Nfields); 106 for (i = 0; i < Nfields; i++) { 107 snprintf (keyword, 80, "TTYPE%d", i+1); 108 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[i].ttype)) ESCAPE; 109 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[i].ttype_cmt)) ESCAPE; 104 105 int field; 106 for (field = 0; field < Nfields; field++) { 107 snprintf (keyword, 80, "TTYPE%d", field+1); 108 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[field].ttype)) ESCAPE; 109 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[field].ttype_cmt)) ESCAPE; 110 110 111 111 // TUNIT is not mandatory 112 snprintf (keyword, 80, "TUNIT%d", i+1);113 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[ i].tunit)) {114 fields[ i].tunit[0] = 0;112 snprintf (keyword, 80, "TUNIT%d", field+1); 113 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[field].tunit)) { 114 fields[field].tunit[0] = 0; 115 115 } else { 116 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[ i].tunit_cmt)) ESCAPE;116 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[field].tunit_cmt)) ESCAPE; 117 117 } 118 118 119 snprintf (keyword, 80, "TFORM%d", i+1);120 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[ i].tformat)) ESCAPE;121 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[ i].tformat_cmt)) ESCAPE;119 snprintf (keyword, 80, "TFORM%d", field+1); 120 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[field].tformat)) ESCAPE; 121 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[field].tformat_cmt)) ESCAPE; 122 122 123 123 // for now we set all fields to the requested type. since I do not yet know the column data types I cannot yet assign automatic cmptypes 124 strcpy (fields[ i].zctype, zcmptype);124 strcpy (fields[field].zctype, zcmptype); 125 125 126 126 // by using "P" format, we are limited to 32bit pointers (2GB heap) 127 if (!gfits_define_bintable_column (tgtheader, "1QB(0)", fields[ i].ttype, fields[i].ttype_cmt, fields[i].tunit, 1.0, 0.0)) ESCAPE;127 if (!gfits_define_bintable_column (tgtheader, "1QB(0)", fields[field].ttype, fields[field].ttype_cmt, fields[field].tunit, 1.0, 0.0)) ESCAPE; 128 128 } 129 129 … … 137 137 char *tmpbuffer = NULL; 138 138 ALLOCATE_ZERO (tmpbuffer, char, 16*Ntile); // need space for Ntile entries, each of width 16 bytes (2 long) 139 for ( i = 0; i < Nfields; i++) {140 if (!gfits_set_bintable_column (tgtheader, tgttable, fields[ i].ttype, tmpbuffer, Ntile)) ESCAPE;139 for (field = 0; field < Nfields; field++) { 140 if (!gfits_set_bintable_column (tgtheader, tgttable, fields[field].ttype, tmpbuffer, Ntile)) ESCAPE; 141 141 } 142 142 free (tmpbuffer); … … 146 146 147 147 // define compression-specific keywords, update header as needed. 148 if (!gfits_modify (tgtheader, "ZTILELEN", "% d", 1, ztilelen)) ESCAPE;148 if (!gfits_modify (tgtheader, "ZTILELEN", "%lud", 1, ztilelen)) ESCAPE; 149 149 150 150 if (!gfits_modify (tgtheader, "ZNAXIS1", OFF_T_FMT, 1, srcheader->Naxis[0])) ESCAPE; … … 163 163 int offset = 0; // bytes from first column of first field to the current field (accumulate to set) 164 164 165 for ( i = 0; i < Nfields; i++) {166 snprintf (keyword, 81, "ZFORM%d", i+1);167 if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[ i].tformat)) ESCAPE;168 if (!gfits_varlength_column_define (tgttable, &fields[ i].zdef, i+1)) ESCAPE;169 if (!gfits_bintable_format (fields[ i].tformat, fields[i].datatype, &fields[i].Nvalues, &fields[i].pixsize)) ESCAPE; //170 fields[ i].rowsize = fields[i].Nvalues*fields[i].pixsize;171 max_width = MAX(max_width, fields[ i].rowsize);172 173 if (!strcasecmp (fields[ i].zctype, "AUTO")) {174 if (!strcmp (fields[ i].datatype, "short") ||175 !strcmp (fields[ i].datatype, "float") ||176 !strcmp (fields[ i].datatype, "double")||177 !strcmp (fields[ i].datatype, "int64_t")) {178 strcpy (fields[ i].zctype, "GZIP_2");165 for (field = 0; field < Nfields; field++) { 166 snprintf (keyword, 81, "ZFORM%d", field+1); 167 if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[field].tformat)) ESCAPE; 168 if (!gfits_varlength_column_define (tgttable, &fields[field].zdef, field+1)) ESCAPE; 169 if (!gfits_bintable_format (fields[field].tformat, fields[field].datatype, &fields[field].Nvalues, &fields[field].pixsize)) ESCAPE; // 170 fields[field].rowsize = fields[field].Nvalues*fields[field].pixsize; 171 max_width = MAX(max_width, fields[field].rowsize); 172 173 if (!strcasecmp (fields[field].zctype, "AUTO")) { 174 if (!strcmp (fields[field].datatype, "short") || 175 !strcmp (fields[field].datatype, "float") || 176 !strcmp (fields[field].datatype, "double")|| 177 !strcmp (fields[field].datatype, "int64_t")) { 178 strcpy (fields[field].zctype, "GZIP_2"); 179 179 goto got_cmptype; 180 180 } 181 if (!strcmp (fields[ i].datatype, "int")) {182 strcpy (fields[ i].zctype, "RICE_1");181 if (!strcmp (fields[field].datatype, "int")) { 182 strcpy (fields[field].zctype, "RICE_1"); 183 183 goto got_cmptype; 184 184 } 185 if (!strcmp (fields[ i].datatype, "byte") ||186 !strcmp (fields[ i].datatype, "char")) {187 strcpy (fields[ i].zctype, "GZIP_1");185 if (!strcmp (fields[field].datatype, "byte") || 186 !strcmp (fields[field].datatype, "char")) { 187 strcpy (fields[field].zctype, "GZIP_1"); 188 188 goto got_cmptype; 189 189 } … … 193 193 194 194 // OVERRIDE: RICE can only be used on integer fields 195 if (!strcasecmp (fields[ i].zctype, "RICE_1") || !strcasecmp (fields[i].zctype, "RICE_ONE")) {196 if (!strcmp (fields[ i].datatype, "float") || !strcmp (fields[i].datatype, "double") || !strcmp (fields[i].datatype, "int64_t")) {197 strcpy (fields[ i].zctype, "GZIP_2");195 if (!strcasecmp (fields[field].zctype, "RICE_1") || !strcasecmp (fields[field].zctype, "RICE_ONE")) { 196 if (!strcmp (fields[field].datatype, "float") || !strcmp (fields[field].datatype, "double") || !strcmp (fields[field].datatype, "int64_t")) { 197 strcpy (fields[field].zctype, "GZIP_2"); 198 198 } 199 199 } 200 200 201 201 // OVERRIDE: GZIP_2 invalid for B (use GZIP_1) 202 if (!strcasecmp (fields[ i].zctype, "GZIP_2") && !strcmp (fields[i].datatype, "byte")) {203 strcpy (fields[ i].zctype, "GZIP_1");202 if (!strcasecmp (fields[field].zctype, "GZIP_2") && !strcmp (fields[field].datatype, "byte")) { 203 strcpy (fields[field].zctype, "GZIP_1"); 204 204 } 205 205 206 206 // compression type per column (XXX for now we are just using zcmptype, as set above) 207 snprintf (keyword, 81, "ZCTYP%d", i+1);208 if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[ i].zctype)) ESCAPE;209 210 fields[ i].offset = offset;211 offset += fields[ i].rowsize;207 snprintf (keyword, 81, "ZCTYP%d", field+1); 208 if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[field].zctype)) ESCAPE; 209 210 fields[field].offset = offset; 211 offset += fields[field].rowsize; 212 212 } 213 213 214 214 // allocate the intermediate storage buffers 215 int Nzdata_alloc = 2*max_width*ztilelen + 100;215 unsigned long int Nzdata_alloc = 2*max_width*ztilelen + 100; 216 216 ALLOCATE (raw, char, max_width*ztilelen); 217 217 ALLOCATE (zdata, char, Nzdata_alloc); … … 229 229 // compress the data : copy into a tile, compress the tile, then add to the output table 230 230 // each tile -> 1 row of the output table 231 for (i = 0; i < Ntile; i++) { 232 233 for (j = 0; j < Nfields; j++) { 234 235 gettimeofday (&startTimer, (void *) NULL); 236 237 int Nrows = (i == Ntile - 1) ? ztilelast : ztilelen; 238 int row_start = i*ztilelen; 231 unsigned long int tile; 232 for (tile = 0; tile < Ntile; tile++) { 233 234 for (field = 0; field < Nfields; field++) { 235 236 gettimeofday (&startTimer, (void *) NULL); 237 238 unsigned long int Nrows = (tile == Ntile - 1) ? ztilelast : ztilelen; 239 unsigned long int row_start = tile*ztilelen; 239 240 // ^- first row for this tile & field 240 241 // NOTE: assumes each tile has the same length, ex the last (true for now) 241 242 242 243 // copy the raw pixels from their native matrix locations to the temporary output buffer 243 if (!strcasecmp(fields[ j].zctype, "GZIP_2") || !strcasecmp(fields[j].zctype, "NONE_2")) {244 if (!gfits_collect_table_gzp2 (srctable, &fields[ j], raw, row_start, Nrows)) ESCAPE;244 if (!strcasecmp(fields[field].zctype, "GZIP_2") || !strcasecmp(fields[field].zctype, "NONE_2")) { 245 if (!gfits_collect_table_gzp2 (srctable, &fields[field], raw, row_start, Nrows)) ESCAPE; 245 246 } else { 246 if (!gfits_collect_table_data (srctable, &fields[ j], raw, row_start, Nrows)) ESCAPE;247 if (!gfits_collect_table_data (srctable, &fields[field], raw, row_start, Nrows)) ESCAPE; 247 248 } 248 249 … … 256 257 257 258 if (VERBOSE_DUMP) { 258 int k;259 unsigned long int k; 259 260 fprintf (stderr, "c1: "); 260 for (k = 0; k < Nrows*fields[ j].Nvalues*fields[j].pixsize; k++) {261 for (k = 0; k < Nrows*fields[field].Nvalues*fields[field].pixsize; k++) { 261 262 fprintf (stderr, "%02hhx", raw[k]); 262 263 if (k % 2) fprintf (stderr, " "); … … 269 270 // optname, optvalue = NULL, Noptions = 0 270 271 271 int Nraw = Nrows*fields[j].Nvalues; // number of pixels272 if (!strcasecmp(fields[ j].zctype, "GZIP_1")) {273 if (!gfits_byteswap_zdata (raw, Nraw * fields[ j].pixsize, fields[j].pixsize)) ESCAPE;272 unsigned long int Nraw = Nrows*fields[field].Nvalues; // number of pixels 273 if (!strcasecmp(fields[field].zctype, "GZIP_1")) { 274 if (!gfits_byteswap_zdata (raw, Nraw * fields[field].pixsize, fields[field].pixsize)) ESCAPE; 274 275 } 275 276 … … 281 282 282 283 if (VERBOSE_DUMP) { 283 int k;284 unsigned long int k; 284 285 fprintf (stderr, "c2: "); 285 for (k = 0; k < Nrows*fields[ j].Nvalues*fields[j].pixsize; k++) {286 for (k = 0; k < Nrows*fields[field].Nvalues*fields[field].pixsize; k++) { 286 287 fprintf (stderr, "%02hhx", raw[k]); 287 288 if (k % 2) fprintf (stderr, " "); … … 291 292 } 292 293 293 int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression294 if (!gfits_compress_data (zdata, &Nzdata, fields[ j].zctype, NULL, NULL, 0, raw, Nraw, fields[j].pixsize, 0, 0)) ESCAPE;294 unsigned long int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression 295 if (!gfits_compress_data (zdata, &Nzdata, fields[field].zctype, NULL, NULL, 0, raw, Nraw, fields[field].pixsize, 0, 0)) ESCAPE; 295 296 296 297 // XXX TIMER 2c … … 301 302 302 303 if (VERBOSE_DUMP) { 303 int k;304 unsigned long int k; 304 305 fprintf (stderr, "c3: "); 305 306 for (k = 0; k < Nzdata; k++) { … … 311 312 } 312 313 313 if (strcasecmp(fields[ j].zctype, "NONE_2") && // NONE and NONE_1 not swapped?314 strcasecmp(fields[ j].zctype, "GZIP_1") &&315 strcasecmp(fields[ j].zctype, "GZIP_2") &&316 strcasecmp(fields[ j].zctype, "RICE_1") &&317 strcasecmp(fields[ j].zctype, "RICE_ONE")) {318 if (!gfits_byteswap_zdata (zdata, Nzdata, fields[ j].pixsize)) ESCAPE;314 if (strcasecmp(fields[field].zctype, "NONE_2") && // NONE and NONE_1 not swapped? 315 strcasecmp(fields[field].zctype, "GZIP_1") && 316 strcasecmp(fields[field].zctype, "GZIP_2") && 317 strcasecmp(fields[field].zctype, "RICE_1") && 318 strcasecmp(fields[field].zctype, "RICE_ONE")) { 319 if (!gfits_byteswap_zdata (zdata, Nzdata, fields[field].pixsize)) ESCAPE; 319 320 } 320 321 … … 326 327 327 328 if (VERBOSE_DUMP) { 328 int k;329 unsigned long int k; 329 330 fprintf (stderr, "c4: "); 330 331 for (k = 0; k < Nzdata; k++) { … … 336 337 } 337 338 338 if (!gfits_varlength_column_add_data (tgttable, zdata, Nzdata, i, &fields[j].zdef)) ESCAPE;339 if (!gfits_varlength_column_add_data (tgttable, zdata, Nzdata, field, &fields[field].zdef)) ESCAPE; 339 340 // XXX TIMER 2e 340 341 gettimeofday (&stopTimer, (void *) NULL); … … 347 348 if (OHANA_MEMCHECK) ohana_memcheck (TRUE); 348 349 349 for ( i = 0; i < Nfields; i++) {350 if (!gfits_varlength_column_finish (tgttable, &fields[ i].zdef)) ESCAPE;350 for (field = 0; field < Nfields; field++) { 351 if (!gfits_varlength_column_finish (tgttable, &fields[field].zdef)) ESCAPE; 351 352 } 352 353 … … 375 376 // raw_pixsize is the bytes / pixel for the input matrix 376 377 // place the raw image bytes for the current tile into the tile buffer 377 int gfits_collect_table_data (FTable *table, TableField *field, char *raw, int row_start,int Nrows) {378 379 off_t i;378 int gfits_collect_table_data (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) { 379 380 unsigned long int i; 380 381 381 382 // we are copying NN rows into the column which starts at XX and has MM bytes per row … … 399 400 } 400 401 401 int gfits_collect_table_data_alt (FTable *table, TableField *field, char *raw, int row_start,int Nrows) {402 403 off_t i;402 int gfits_collect_table_data_alt (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) { 403 404 unsigned long int i; 404 405 405 406 // we are copying NN rows of the column which starts at XX and has MM bytes per row … … 420 421 } 421 422 422 int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, int row_start,int Nrows) {423 424 off_t i,j, k;423 int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) { 424 425 off_t j, k; 425 426 426 427 // we are copying NN rows into the column which starts at XX and has MM bytes per row … … 439 440 char *tblptr_start = &table->buffer[Nx*row_start + offset + k]; 440 441 # endif 442 unsigned long int i; 441 443 for (i = 0; i < Nrows; i++, tblptr_start += Nx) { 442 444 char *tblptr = tblptr_start; … … 449 451 } 450 452 451 int gfits_collect_table_gzp2_alt (FTable *table, TableField *field, char *raw, int row_start,int Nrows) {452 453 off_t i,j, k;453 int gfits_collect_table_gzp2_alt (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) { 454 455 off_t j, k; 454 456 455 457 // we are copying NN rows into the column which starts at XX and has MM bytes per row … … 458 460 459 461 for (k = 0; k < field->pixsize; k++) { 462 unsigned long int i; 460 463 for (i = 0; i < Nrows; i++) { 461 int row = row_start + i;464 unsigned long int row = row_start + i; 462 465 char *rawptr = &raw[i*field->Nvalues + k*Nrows*field->Nvalues]; 463 466 # ifdef BYTE_SWAP … … 468 471 for (j = 0; j < field->Nvalues; j++, tblptr += field->pixsize, rawptr++) { 469 472 *rawptr = *tblptr; 470 myAssert (rawptr - raw < Nrows*field->Nvalues*field->pixsize, "oops"); 473 myAssert (rawptr >= raw, "oops"); 474 myAssert ((unsigned long int)(rawptr - raw) < Nrows*field->Nvalues*field->pixsize, "oops"); 471 475 myAssert (tblptr - table->buffer < table->header->Naxis[0]*table->header->Naxis[1], "oops"); 472 476 } -
branches/eam_branches/ohana.20160226/src/libfits/table/F_uncompress_T.c
r39358 r39409 22 22 } 23 23 fprintf (stderr, "\n"); 24 # else 25 OHANA_UNUSED_PARAM(table); 26 OHANA_UNUSED_PARAM(message); 24 27 # endif 25 28 return TRUE; … … 44 47 } 45 48 fprintf (stderr, "\n"); 49 # else 50 OHANA_UNUSED_PARAM(table); 51 OHANA_UNUSED_PARAM(message); 46 52 # endif 47 53 return TRUE; … … 266 272 gettimeofday (&startTimer, (void *) NULL); 267 273 268 int Nrows = (row == Ntile - 1) ? ztilelast : ztilelen;269 int Nraw = Nrows*fields[i].Nvalues*fields[i].pixsize; // expected number of bytes274 unsigned long int Nrows = (row == Ntile - 1) ? ztilelast : ztilelen; 275 unsigned long int Nraw = Nrows*fields[i].Nvalues*fields[i].pixsize; // expected number of bytes 270 276 if (!gfits_uncompress_data (zdata, Nzdata, fields[i].zctype, NULL, NULL, 0, raw, &Nraw, Nraw_alloc, fields[i].pixsize)) ESCAPE; 271 277 272 278 if (VERBOSE_DUMP) { 273 int k;279 unsigned long int k; 274 280 fprintf (stderr, "u2: "); 275 281 for (k = 0; k < Nraw*fields[i].pixsize; k++) { … … 299 305 300 306 if (VERBOSE_DUMP) { 301 int k;307 unsigned long int k; 302 308 fprintf (stderr, "u1: "); 303 309 for (k = 0; k < Nraw*fields[i].pixsize; k++) { -
branches/eam_branches/ohana.20160226/src/libfits/table/F_write_T.c
r38553 r39409 27 27 myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory"); 28 28 myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory"); 29 myAssert (myBlock->size >= table[0].datasize, "overflow");29 myAssert (myBlock->size >= (size_t) table[0].datasize, "overflow"); 30 30 } 31 31 # endif -
branches/eam_branches/ohana.20160226/src/libfits/table/F_write_TH.c
r38553 r39409 27 27 myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory"); 28 28 myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory"); 29 myAssert (myBlock->size >= header[0].datasize, "overflow");29 myAssert (myBlock->size >= (size_t) header[0].datasize, "overflow"); 30 30 } 31 31 # endif -
branches/eam_branches/ohana.20160226/src/libohana/include/ohana.h
r39407 r39409 400 400 int write_fmt PROTO((int fd, char *format, ...)) OHANA_FORMAT(printf, 2, 3); 401 401 402 char **isolate_elements PROTO(( int argc, char **argv,int *nstack));402 char **isolate_elements PROTO((unsigned int argc, char **argv, unsigned int *nstack)); 403 403 404 404 // functions used to manage "last error message" -
branches/eam_branches/ohana.20160226/src/libohana/src/Fread.c
r29537 r39409 44 44 45 45 static int ByteSwap (char *ptr, off_t size, off_t nitems, char *type) { 46 OHANA_UNUSED_PARAM(size); 46 47 47 # ifdef BYTE_SWAP 48 # ifndef BYTE_SWAP 49 OHANA_UNUSED_PARAM(ptr); 50 OHANA_UNUSED_PARAM(nitems); 51 OHANA_UNUSED_PARAM(type); 52 return (TRUE); 53 54 # else 48 55 49 56 off_t i; … … 108 115 return (FALSE); 109 116 110 # else111 112 return (TRUE);113 114 117 # endif 115 118 -
branches/eam_branches/ohana.20160226/src/libohana/src/config.c
r39393 r39409 43 43 uid_t uid; 44 44 gid_t gid; 45 int i, N, NDEF, status;45 int unsigned i, N, NDEF, status; 46 46 47 47 /* first look for -C CONFIG variable */ -
branches/eam_branches/ohana.20160226/src/libohana/src/gaussj.c
r39369 r39409 20 20 // numerical precision, I am raising an error if |growth| > 1e8 21 21 int dgaussjordan_pivot (double **A, double **B, int N, int M, double MIN_PIVOT) { 22 OHANA_UNUSED_PARAM(MIN_PIVOT); 22 23 23 24 int *colIndex; -
branches/eam_branches/ohana.20160226/src/libohana/src/isolate_elements.c
r31635 r39409 1 // # include "opihi.h" 2 // 3 #include "ohana.h" 1 # include "ohana.h" 4 2 5 3 /* local private functions */ 6 char **InsertValue (char **myOutput, int *Nout, int *Nchar,int *NCHAR, char c);7 char **EndOfString (char **myOutput, int *Nout, int *Nchar, int *NOUT,int *NCHAR);4 char **InsertValue (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NCHAR, char c); 5 char **EndOfString (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NOUT, unsigned int *NCHAR); 8 6 int IsAnOp (char *c); 9 7 int IsTwoOp (char *c); 10 8 11 char **isolate_elements ( int Nin, char **in,int *nout) {9 char **isolate_elements (unsigned int Nin, char **in, unsigned int *nout) { 12 10 13 11 /* local private static variables */ 14 int NCHAR, Nchar, Nout, NOUT;12 unsigned int NCHAR, Nchar, Nout, NOUT; 15 13 char **myOutput; 16 14 17 int i, j, minus, negate, plus, posate, OpStat, SciNotation;15 unsigned int i, j, minus, negate, plus, posate, OpStat, SciNotation; 18 16 19 17 NOUT = Nin; … … 142 140 } 143 141 144 char **InsertValue (char **myOutput, int *Nout, int *Nchar,int *NCHAR, char c) {142 char **InsertValue (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NCHAR, char c) { 145 143 myOutput[*Nout][*Nchar] = c; 146 144 (*Nchar) ++; … … 153 151 } 154 152 155 char **EndOfString (char **myOutput, int *Nout, int *Nchar, int *NOUT,int *NCHAR) {153 char **EndOfString (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NOUT, unsigned int *NCHAR) { 156 154 if ((*Nchar) > 0) { 157 155 myOutput[*Nout][*Nchar] = 0; -
branches/eam_branches/ohana.20160226/src/libohana/src/ohana_allocate.c
r39407 r39409 17 17 # define TRUE 1 18 18 # define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) 19 20 // a no-op to mark unused parameters in a function 21 # define OHANA_UNUSED_PARAM(x)(void)(x) 19 22 20 23 static OhanaMemblock *lastBlock = NULL; -
branches/eam_branches/ohana.20160226/src/relastro/src/UpdateObjects.c
r39390 r39409 257 257 } 258 258 259 // if we have fitted (and accepted) a parallax model, get the best pm fit and chisq 260 // given the set of points (mask is respected) 259 261 if (average[0].flags & ID_OBJ_USE_PAR) { 260 // get the best pm fit and chisq given the set of points (mask is respected)261 262 if (!FitPM_Basic (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) { 262 263 average[0].flags |= ID_OBJ_BAD_PM;
Note:
See TracChangeset
for help on using the changeset viewer.
