AlcapDAQ  1
mucap_compress.h
Go to the documentation of this file.
1 // io_buffer.cpp ----------------------------------------
2 
3 typedef struct io_buffer {
4  unsigned int w;
5  int w_bits;
6  unsigned int *start;
7  unsigned int *p;
8  int num_codes;
9 } io_buffer;
10 
11 void start_output_buffer(io_buffer * buffer, unsigned char *p);
12 int flush_output_buffer(io_buffer * buffer);
13 void io_buffer_put(io_buffer * buffer, unsigned int code_bits,
14  int code_length);
15 void start_input_buffer(io_buffer * buffer, unsigned char *p);
16 unsigned int io_buffer_get(io_buffer * buffer, int num_bits);
17 
18 // huffman.cpp ----------------------------------------
19 
20 typedef struct huffman_node huffman_node;
21 
22 typedef struct huffman_table {
24  int *frequency;
25  unsigned int *code_bits;
30 
31 void huffman_put_symbol(huffman_table * table, io_buffer * buffer,
32  int symbol);
33 int huffman_get_symbol(huffman_table * table, io_buffer * buffer);
35 void huffman_init_default(huffman_table * table, int num_symbols);
36 BOOL save_huffman(char *key_dir, huffman_table * table);
37 BOOL load_huffman(char *key_dir, huffman_table * table);
38 
39 // rle.cpp ----------------------------------------
40 
41 typedef struct rle_state {
47 } rle_state;
48 
49 void rle_bits_setup();
50 void rle_put(unsigned char b, rle_state * s, io_buffer * output);
51 int flush_rle(rle_state * s, io_buffer * output);
52 int rle_get(io_buffer * input, rle_state * s);
53 
54 // tdc400_compress.cpp ----------------------------------------
55 
56 typedef struct tdc400_word tdc400_word;
57 
58 void tdc400_load();
59 void tdc400_optimize();
60 int tdc400_compress(tdc400_word * input, int input_size,
61  unsigned char *output, int userParam);
62 int tdc400_expand(unsigned char *input, int input_size,
63  tdc400_word * output, int userParam);
64 
66 extern BOOL should_compress_tdc400;
67 
68 // stck_compress.cpp ----------------------------------------
69 
70 typedef struct stack_elt stack_elt;
71 
72 void stck_load();
73 void stck_optimize();
74 int stck_compress(stack_elt * input, int input_size,
75  unsigned char *output, int userParam);
76 int stck_expand(unsigned char *input, int input_size,
77  stack_elt * output, int userParam);
78 
79 // caen_compress.cpp ----------------------------------------
80 
81 typedef struct caen_word caen_word;
82 
83 void comp_load();
84 void comp_optimize();
85 int caen_compress(caen_word * input, int input_size, unsigned char *output, int userParam);
86 int caen_expand(unsigned char *input, int input_size, caen_word * output, int userParam);
87 
89 extern BOOL should_compress_caen;
90 
91 // hits_compress.cpp ----------------------------------------
92 
93 typedef struct channel_hit channel_hit;
94 
95 void hits_load();
96 void hits_optimize();
97 int hits_compress(channel_hit * input, int input_size, unsigned char *output, int userParam);
98 int hits_expand(unsigned char *input, int input_size, channel_hit * output, int userParam);
99 
100 // comp_compress.cpp ----------------------------------------
101 
102 typedef union comp_word comp_word;
103 
104 void caen_load();
105 void caen_optimize();
106 int cmp_compress(comp_word * input, int input_size, unsigned char *output, int userParam);
107 int cmp_expand(unsigned char *input, int input_size, comp_word * output, int userParam);
108 
110 extern BOOL should_compress_comp;
111 
112 // fadc_compress.cpp ----------------------------------------
113 
114 typedef struct fadc_word fadc_word;
115 
116 void fadc_load();
117 void fadc_optimize();
118 int fadc_compress(fadc_word * input, int input_size, unsigned char *output, int userParam);
119 int fadc_expand(unsigned char *input, int input_size, fadc_word * output, int userParam);
120 
122 extern BOOL should_compress_fadc;
123 
124 // nfadc_compress.cpp ----------------------------------------
125 
126 typedef struct nfadc_word nfadc_word;
127 
128 void nfadc_load();
129 void nfadc_optimize();
130 int nfadc_compress(unsigned char * input, int input_size, unsigned char *output, int userParam);
131 int nfadc_expand(unsigned char *input, int input_size, unsigned char * output, int userParam);
132 
133 extern BOOL should_compress_nfadc;
134 
135 /* Beginning of run11 additions */
136 // Run 11 tpc definition
137 // n2fadc_tpc_compress.cpp ----------------------------------------
138 
140 
141 void n2fadc_tpc_load();
142 void n2fadc_tpc_optimize();
143 int n2fadc_tpc_compress(unsigned char * input, int input_size, unsigned char *output, int userParam);
144 int n2fadc_tpc_expand(unsigned char *input, int input_size, unsigned char * output, int userParam);
145 
146 extern BOOL should_compress_n2fadc_tpc;
147 
148 // n2fadc_ndet_compress.cpp ----------------------------------------
149 
151 
152 void n2fadc_ndet_load();
153 void n2fadc_ndet_optimize();
154 int n2fadc_ndet_compress(unsigned char * input, int input_size, unsigned char *output, int userParam);
155 int n2fadc_ndet_expand(unsigned char *input, int input_size, unsigned char * output, int userParam);
156 
157 extern BOOL should_compress_n2fadc_ndet;
158 
159 /* end of run 11 definitions */
160 
161 // overall.cpp ----------------------------------------
162 
163 extern HNDLE hDB;
164 typedef int (*expand_fcn)(unsigned char *input, int input_size, void *output, int userParam);
165 
166 int read_midas_event(FILE * fp, char *pevent);
167 void compress_event(void *input_event, void *output_event, bool USE_OLD_COMPRESSION=false);
168 void compress_event_skim(void *input_event, void *output_event, bool keep_etc,
169  bool USE_OLD_COMPRESSION=false);
170 void expand_event(void *input_event, void *output_event, bool USE_OLD_COMPRESSION=false);
171 void expand_bank(unsigned char *input_data, int input_size, void *output_event,
172  char *output_name, expand_fcn f, int userParam);
173 void compress_load_all(bool USE_OLD_COMPRESSION=false);
174 
175 void compress_optimize_all(bool USE_OLD_COMPRESSION=false);
176