60 for (i = 0; i < 256; i++)
76 fprintf(stderr,
"ERROR: file name pointer is zero\n");
80 if (wave_packet_descr == 0)
82 fprintf(stderr,
"ERROR: wave packet descriptor pointer is zero\n");
94 for (i = 0; i < 256; i++)
waveforms[i] = 0;
97 for (i = 0; i < 256; i++)
99 if (wave_packet_descr[i])
123 char* file_name_temp = strdup(file_name);
125 int len = strlen(file_name_temp);
126 if (file_name_temp[len-3] ==
'L' || file_name_temp[len-3] ==
'W')
128 file_name_temp[len-3] =
'W';
129 file_name_temp[len-2] =
'D';
130 file_name_temp[len-1] = (compressed ?
'Z' :
'P');
134 file_name_temp[len-3] =
'w';
135 file_name_temp[len-2] =
'd';
136 file_name_temp[len-1] = (compressed ?
'z' :
'p');
138 file = fopen(file_name_temp,
"wb");
142 fprintf(stderr,
"ERROR: cannot open waveform file '%s'\n", file_name_temp);
143 free(file_name_temp);
146 free(file_name_temp);
161 U16 reserved = 0xAABB;
164 fprintf(stderr,
"ERROR: writing EVLR reserved\n");
168 memset(user_id, 0, 16);
169 strcpy(user_id,
"LASF_Spec");
172 fprintf(stderr,
"ERROR: writing EVLR user_id\n");
175 U16 record_id = 65535;
178 fprintf(stderr,
"ERROR: writing EVLR record_id\n");
181 I64 record_length_after_header = 0;
184 fprintf(stderr,
"ERROR: writing EVLR record_length_after_header\n");
188 memset(description, 0, 32);
189 sprintf(description,
"%s by LAStools (%d)", (compressed ?
"compressed" :
"created"),
LAS_TOOLS_VERSION);
192 fprintf(stderr,
"ERROR: writing EVLR description\n");
203 fprintf(stderr,
"ERROR: writing waveform descriptor cross-check\n");
209 fprintf(stderr,
"ERROR: writing number of waveform descriptors\n");
213 for (i = 0; i < 256; i++)
219 fprintf(stderr,
"ERROR: writing index of waveform descriptor %d\n", i);
224 fprintf(stderr,
"ERROR: writing compression of waveform descriptor %d\n", i);
229 fprintf(stderr,
"ERROR: writing nbits of waveform descriptor %d\n", i);
234 fprintf(stderr,
"ERROR: writing nsamples of waveform descriptor %d\n", i);
261 if ((nbits != 8) && (nbits != 16))
263 fprintf(stderr,
"ERROR: waveform with %d bits per samples not supported yet\n", nbits);
270 fprintf(stderr,
"ERROR: waveform has no samples\n");
283 U32 size = ((nbits/8) * nsamples);
286 fprintf(stderr,
"ERROR: cannot write %u bytes for waveform with %u samples of %u bits\n", size, nsamples, nbits);
299 for (s_count = 1; s_count < nsamples; s_count++)
301 ic8->
compress(samples[s_count-1], samples[s_count]);
309 for (s_count = 1; s_count < nsamples; s_count++)
327 record_length_after_header -= 60;
331 fprintf(stderr,
"ERROR: updating EVLR record_length_after_header\n");