- Timestamp:
- May 26, 2015, 4:29:20 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_utils.c
r38322 r38326 13 13 // XXX inconsistency between data element size between compressed data, uncompressed data, 14 14 // and output pixel data..... 15 16 // need a structure to describe tiles, current tile? 17 18 typedef struct { 19 int *ztile; // max size of a tile (edge tiles may be smaller) 20 int *otile; // counter for current tile (eg, for (2,3,0) otile[0] = 2, otile[1] = 3, otile[2] = 0) 21 int *ntile; // number of tiles in dimension [i] 22 } ImageTile; 23 24 // advance the otile counter. 25 int gfits_imtile_next (Matrix *matrix, int *ztile, int *ntile, int *otile) { 26 27 int i; 28 29 // update the tile counters, carrying to the next dimension if needed 30 for (i = 0; i < matrix->Naxes; i++) { 31 otile[i] ++; 32 if (otile[i] == ntile[i]) { 33 if (i == matrix->Naxes - 1) return FALSE; 34 otile[i] = 0; 35 } else { 36 return TRUE; 37 } 38 } 39 return TRUE; 40 } 41 42 // how many tiles needed for this image (given ztile[]) 43 int gfits_imtile_start (Matrix *matrix, int *otile) { 44 45 int i; 46 47 // update the tile counters, carrying to the next dimension if needed 48 for (i = 0; i < matrix->Naxes; i++) { 49 otile[i] = 0; 50 } 51 } 52 53 // how many tiles needed for this image (given ztile[]) 54 int gfits_imtile_count (Matrix *matrix, int *ztile, int *ntile) { 55 56 int i; 57 58 int Ntiles = 1; 59 for (i = 0; i < matrix->Naxes; i++) { 60 ntile[i] = (matrix->Naxis[i] % ztile[i]) ? (matrix->Naxis[i] / ztile[i] + 1) : (matrix->Naxis[i] / ztile[i]); 61 Ntiles *= ntile[i]; 62 } 63 64 return (Ntiles); 65 } 66 67 // how many tiles needed for this image (given ztile[]) 68 int gfits_imtile_maxsize (Matrix *matrix, int *ztile) { 69 70 int i; 71 72 int max_tile_size = 1; 73 for (i = 0; i < matrix->Naxes; i++) { 74 max_tile_size *= ztile[i]; 75 } 76 77 return (max_tile_size); 78 } 15 79 16 80 // true sizes of this tile (in pixels)
Note:
See TracChangeset
for help on using the changeset viewer.
