1 /* 2 * HIPL Picture Header Format Standard 3 * 4 * Michael Landy - 2/1/82 5 */ 6 7 #define XHEADER 8 #ifdef XHEADER 9 struct extended { 10 char *name; 11 char *vals; 12 }; 13 #endif 14 15 struct header { 16 char *orig_name; /* The originator of this sequence */ 17 char *seq_name; /* The name of this sequence */ 18 int num_frame; /* The number of frames in this sequence */ 19 char *orig_date; /* The date the sequence was originated */ 20 int rows; /* The number of rows in each image */ 21 int cols; /* The number of columns in each image */ 22 int bits_per_pixel; /* The number of significant bits per pixel */ 23 int bit_packing; /* Nonzero if bits were packed contiguously */ 24 int pixel_format; /* The format of each pixel, see below */ 25 char *seq_history; /* The sequence's history of transformations */ 26 char *seq_desc; /* Descriptive information */ 27 #ifdef XHEADER 28 struct extended *xheader; 29 #endif 30 }; 31 32 /* 33 * Pixel Format Codes 34 */ 35 36 #define PFBYTE 0 /* Bytes interpreted as integers (8 bits) */ 37 #define PFSHORT 1 /* Short integers (2 bytes) */ 38 #define PFINT 2 /* Integers (4 bytes) */ 39 #define PFFLOAT 3 /* Float's (4 bytes)*/ 40 #define PFCOMPLEX 4 /* 2 Float's interpreted as (real,imaginary) */ 41 #define PFASCII 5 /* ASCII rep, with linefeeds after each row */ 42 #define PFDOUBLE 6 /* Double's (8 byte floats) */ 43 #define PFDBLCOM 7 /* Double complex's (2 Double's) */ 44 #define PFQUAD 10 /* quad-tree encoding (Mimaging) */ 45 #define PFQUAD1 11 /* quad-tree encoding */ 46 #define PFBHIST 12 /* histogram of byte image (using ints) */ 47 #define PFSPAN 13 /* spanning tree format */ 48 #define PLOT3D 24 /* plot-3d format */ 49 #define PFINTPYR 50 /* integer pyramid */ 50 #define PFFLOATPYR 51 /* float pyramid */ 51 #define PFPOLYLINE 100 /* 2D points */ 52 #define PFCOLVEC 101 /* Set of RGB triplets defining colours */ 53 #define PFUKOOA 102 /* Data in standard UKOOA format */ 54 #define PFTRAINING 104 /* Set of colour vector training examples */ 55 #define PFTOSPACE 105 /* TOspace world model data structure */ 56 #define PFSTEREO 106 /* Stereo sequence (l, r, l, r, ...) */ 57 #define PFRGPLINE 107 /* 2D points with regions */ 58 #define PFRGISPLINE 108 /* 2D points with regions and interfaces */ 59 #define PFCHAIN 200 /* Chain code encoding (Mimaging) */ 60 #define PFLUT 300 /* LUT format (uses Ints) (Mimaging) */ 61 #define PFAHC 400 /* adaptive hierarchical encoding */ 62 #define PFOCT 401 /* oct-tree encoding */ 63 #define PFBT 402 /* binary tree encoding */ 64 #define PFAHC3 403 /* 3-d adaptive hierarchical encoding */ 65 #define PFBQ 404 /* binquad encoding */ 66 #define PFRLED 500 /* run-length encoding */ 67 #define PFRLEB 501 /* run-length encoding, line begins black */ 68 #define PFRLEW 502 /* run-length encoding, line begins white */ 69 #define PFPOLAR 600 /* rho-theta format (Mimaging) */ 70 71 /* 72 * Bit packing formats 73 */ 74 75 #define MSBFIRST 1 /* bit packing - most significant bit first */ 76 #define LSBFIRST 2 /* bit packing - least significant bit first */ 77 78 #define FBUFLIMIT 30000 /* increase this if you use large PLOT3D 79 files */ 80 81 /* 82 * For general readability 83 */ 84 85 #ifndef TRUE 86 # define TRUE 1 87 #endif 88 89 #ifndef FALSE 90 # define FALSE 0 91 #endif 92 93 typedef long Boolean; 94 extern char *strsave(), *memalloc(); 95 96 /* 97 * image and pyramid type declarations for the pyramid routines. 98 * 99 * The pyramid utilities are derived from code originally written by 100 * Raj Hingorani at SRI/David Sarnoff Research Institute. The original 101 * Gaussian and Laplacian pyramid algorithms were designed by Peter Burt (also 102 * currently at SRI/DSRC). See: Computer Graphics and Image Processing, 103 * Volume 16, pp. 20-51, 1981, and IEEE Transactions on Communications, 104 * Volume COM-31, pp. 532-540, 1983. 105 */ 106 107 #define MAXLEV 12 108 109 110 typedef struct { 111 float **ptr; 112 int nr; 113 int nc; 114 } FIMAGE; 115 116 typedef struct { 117 int **ptr; 118 int nr; 119 int nc; 120 } IIMAGE; 121 122 typedef FIMAGE FPYR[MAXLEV]; 123 typedef IIMAGE IPYR[MAXLEV]; 124 125 typedef struct { 126 float *k; 127 int taps2; /* the number of taps from the center rightward, 128 total number is 2*taps2-1 */ 129 } FILTER; 130 131 /* function definitions */ 132 133 float **_read_fimgstr(); 134 int **_read_iimgstr(); 135 float **_alloc_fimage(); 136 int **_alloc_iimage(); 137 138 /* image macros */ 139 140 #ifndef MAX 141 # define MAX(A,B) ((A) > (B) ? (A) : (B)) 142 #endif /* MAX */ 143 #ifndef MIN 144 # define MIN(A,B) ((A) < (B) ? (A) : (B)) 145 #endif /* MIN */ 146 #ifndef ABS 147 # define ABS(A) ((A) > 0 ? (A) : (-(A))) 148 #endif /* ABS */ 149 #ifndef BETWEEN 150 # define BETWEEN(A,B,C) (((A) < (B)) ? (B) : (((A) > (C)) ? (C) : (A))) 151 #endif /* BETWEEN */ 152 #ifndef SIGN 153 # define SIGN(A,B) (((B) > 0) ? (A) : (-(A))) 154 #endif /* SIGN */ 155