CubeBuilder.h 2.67 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89

#define RW_MAXFILES 9999         /* Max files per tape to read */
#define RW_MAXRECORDS 1000000000 /* Max number of records per tape to read */
#define RW_DATFILE "incub8r.inc" /* Defaults file for hypercube */

#define RW_CHNK_S  32      /* size of update chunk, in units of 1/4 MB      */

/*
   RW_LB2 = ceil((float)(ceil((float)((RW_MAXCH/8)*((RW_MAXCH/8)+1)*((RW_MAXCH/8)+2)/6)/128))/RW_CHNK_S)
   RW_LB1 = RW_LB2*RW_CHNK_S
*/

//for 1400 channels

//#define RW_MAXCH 1400            /* Maximum channels on cube axis */
//                                 /*    (must be multiple of 8)    */
//#define RW_LB2 222         /* length required for buf2, depends on RW_LB1   */
//                           /* RW_LB2 >= RW_LB1/RW_CHNK_S                    */
//#define RW_LB1 7104        /* length required for buf1, depends on RW_MAXCH */
//                           /* RW_LB1 > x(x+1)(x+2)/(6*128),                 */
//		                     /* where x = RW_MAXCH/8                          */
//                           /* must also be a multiple of RW_CHNK_S          */

//for 4096channels

//#define RW_MAXCH 4096

//#define RW_LB1 175808



//#define RW_LB2 5494


//for 8196 channels

#define RW_MAXCH 8192

#define RW_LB1 1402208

#define RW_LB2 43819








#define RW_DB1 90          /* depth of buf1 */

#define RW_DB2 180         /* depth of buf2 not to exceed RW_SCR_RECL       */
                           /* byte records in scr file                      */
#define RW_SCR_RECL 32768  /* Record length of scr file                     */
                           /* must be >= RW_DB2*2*(RW_DB1+1) + 4            */
#define RW_MAXMULT 40


/************************************************
 *  3D CUBE FILE FORMAT
 *  1024byte file header
 *  4096byte data records
 *
 *      each data record contains:
 *      variable number of bit-compressed 8x8x4 mini-cubes
 *      8bytes header, 4088 bytes of data
 */

  /* 3d cube file header */
typedef struct {
  char id[16];            /* "Incub8r3/Pro4d  " */
  int  numch;             /* number of channels on axis */
  int  bpc;               /* bytes per channel, = 4 */
  int  cps;               /* 1/cps symmetry compression, = 6 */
  int  numrecs;           /* number of 4kB data records in the file */
  char resv[992];         /* FUTURE flags */
} FHead3D;

  /* 3Drecord header */
typedef struct {
  int minmc;          /* start minicube number, starts at 0 */
  short nummc;        /* number of minicubes stored in here */
  short offset;       /* offset in bytes to first full minicube */
} RHead3D;

typedef struct {
  RHead3D h;
  unsigned char d[4088];  /* the bit compressed data */
} Record3D;               /* see the compression alg for details */