28 save_huffman(
"/Compression/Lossless/STCK/Huffman/Bits 0", &stck_bits_huffman[0]);
29 save_huffman(
"/Compression/Lossless/STCK/Huffman/Bits 1", &stck_bits_huffman[1]);
38 load_huffman(
"/Compression/Lossless/STCK/Huffman/Bits 0", &stck_bits_huffman[0]);
39 load_huffman(
"/Compression/Lossless/STCK/Huffman/Bits 1", &stck_bits_huffman[1]);
41 int size =
sizeof(BOOL);
43 &size, TID_BOOL,
TRUE);
60 unsigned short prev_run_time = 0;
62 for (
int i = 0;
i < input_size;
i++) {
63 if (input[
i].
time != -1.0) {
65 int this_time = (int) ((input[
i].
time+0.1)/200);
66 int this_run_time_diff = this_time - prev_run_time;
67 if (this_run_time_diff < 2048) {
74 prev_run_time = this_time;
78 if (run_length != 0) {
79 if(run_length < 256) {
89 if (run_length != 0) {
90 if(run_length < 256) {
109 unsigned short prev_run_time = 0;
111 for (
int i = 0;
i < num_words_in;
i++) {
114 if (first_time_length_flag) {
122 if (run_length_flag) {
128 output[output_size++].
time = -1;
129 for (
int j = 0; j < run_length; j++) {
130 output[output_size++].
time = (first_time + prev_run_time + j)*200;
133 prev_run_time += first_time;
153 rle_state s = { 0, 0, {128, 128}, 1, stck_bits_huffman };
155 for(
int i = 0;
i < 3;
i++) {
156 for (
int j = 0; j < input_size; j++) {
157 for (
int k = 0; k < 6; k++) {
158 unsigned char b = input[j].
thr[
i].
Aword[k] & 0xff;
160 b = (input[j].
thr[
i].
Aword[k] >> 8) & 0xff;
165 for (
int j = 0; j < input_size; j++) {
166 for (
int k = 0; k < 3; k++) {
167 unsigned char b = input[j].
thr[
i].
Sword[k] & 0xff;
169 b = (input[j].
thr[
i].
Sword[k] >> 8) & 0xff;
180 rle_state s = { 1, 0, {128, 128}, 1, stck_bits_huffman };
182 for(
int i = 0;
i < 3;
i++) {
183 for (
int j = 0; j < output_size; j++) {
184 for (
int k = 0; k < 6; k++) {
187 if(b1 >= 0 && b2 >= 0) {
188 output[j].
thr[
i].
Aword[k] = (b2 << 8) | b1;
195 for (
int j = 0; j < output_size; j++) {
196 for (
int k = 0; k < 3; k++) {
199 if(b1 >= 0 && b2 >= 0) {
200 output[j].
thr[
i].
Sword[k] = (b2 << 8) | b1;
207 for (
int j = 0; j < output_size; j++) {
209 for(
int k = 0; k < 6; k++) {
210 bit = bit || (output[j].
thr[
i].
Aword[k] != 0);
212 for(
int k = 0; k < 3; k++) {
213 bit = bit || (output[j].
thr[
i].
Sword[k] != 0);
221 unsigned char *output,
int userParam)
236 int *uncompressed_size_p = (
int *) output;
237 *uncompressed_size_p = input_size;
238 output +=
sizeof(int);
241 int *compressed_time_size_p = (
int *) output;
242 output +=
sizeof(int);
246 int compressed_time_size =
248 output += compressed_time_size;
251 *compressed_time_size_p = compressed_time_size;
254 int *compressed_bits_size_p = (
int *) output;
255 output +=
sizeof(int);
259 int compressed_bits_size =
261 output += compressed_time_size;
264 *compressed_bits_size_p = compressed_bits_size;
266 return compressed_time_size + compressed_bits_size + 3 *
sizeof(int);
280 int *uncompressed_size_p = (
int *) input;
281 int uncompressed_size = *uncompressed_size_p;
282 input +=
sizeof(int);
283 input_size -=
sizeof(int);
286 int *compressed_time_size_p = (
int *) input;
287 int compressed_time_size = *compressed_time_size_p;
288 input +=
sizeof(int);
289 input_size -=
sizeof(int);
295 input += compressed_time_size;
296 input_size -= compressed_time_size;
299 int *compressed_bits_size_p = (
int *) input;
300 int compressed_bits_size = *compressed_bits_size_p;
301 input +=
sizeof(int);
302 input_size -=
sizeof(int);
306 decode_bits(&input_buffer, output, uncompressed_size);
310 return uncompressed_size *
sizeof(
stack_elt);
317 for(
int i = index1;
i <= index2;
i++) {
320 for(
int j = 0; j < 3; j++) {
321 printf(
" | %d | ", stackArray[
i].thrbits[j]);
322 for(
int k = 0; k < 6; k++) {
323 printf(
"0x%08x ", stackArray[
i].thr[j].Aword[k]);
326 for(
int k = 0; k < 3; k++) {
327 printf(
"0x%08x ", stackArray[
i].thr[j].Sword[k]);
333 printf(
"%f: \n", stackArray[
i].time);
334 for(
int j = 0; j <
sizeof(
stack_elt); j++) {
335 printf(
"%d ", ((
char *) &stackArray[
i])[j]);
346 for (
int index=index1; index<=index2; index++) {
347 if (stackArray[index].
time > 0) {
349 for (
int section=1; section<=5; section++) {
350 for (
int anode=0; anode<16; anode++) {
351 if (stackArray[index].thr[2].Aword[section-1] & (1 << anode)) {
354 if (stackArray[index].thr[1].Aword[section-1] & (1 << anode)) {
357 if (stackArray[index].thr[0].Aword[section-1] & (1 << anode)) {
369 for (
int section=1; section<=3; section++) {
376 for (
int strip=0; strip<maxstrip; strip++) {
377 if (stackArray[index].thr[2].Sword[section-1] & (1 << strip)) {
380 if (stackArray[index].thr[1].Sword[section-1] & (1 << strip)) {
383 if (stackArray[index].thr[0].Sword[section-1] & (1 << strip)) {
393 printf(
" [%d].time = %0.0f ns\n",index,stackArray[index].
time);
395 if (index != index2) {
396 printf(
" |10 |20 |30 |40 |50 ");
399 printf(
"----------------------------------------------------------");
400 printf(
"----------------------------------------------------------");
401 printf(
" [%d].time = %0.0f\n", index, stackArray[index].
time);