77 #pragma warning (disable: 4996)
97 #define IO_SUCCESS (0)
102 #define NUM_COEFF "13"
107 #define DISPLAY_SIZE "10"
108 #define STR_MAX_INT "2147483647"
110 static arg_t arg[] = {
115 "Log file (default stdout/stderr)"},
119 "Number of coefficients in the feature vector."},
123 "Number of displayed coefficients."},
127 "Whether header is shown."},
131 "Whether description will be shown."},
135 "The beginning frame 0-based."},
139 "The ending frame."},
143 "Input feature file."},
147 int read_cep(
char const *file,
float ***cep,
int *nframes,
int numcep);
150 main(
int argc,
char *argv[])
153 int32 noframe, vsize, dsize, column;
154 int32 frm_begin, frm_end;
155 int is_header, is_describe;
170 E_FATAL(
"-i : Input vector size should be larger than 0.\n");
172 E_FATAL(
"-d : Column size should be larger than 0\n");
174 E_FATAL(
"-b : Beginning frame should be larger than 0\n");
178 if (frm_begin >= frm_end)
180 (
"Ending frame (-e) should be larger than beginning frame (-b).\n");
183 E_FATAL(
"Input file was not specified with (-f)\n");
185 if (read_cep(cepfile, &cep, &noframe, vsize) == IO_ERR)
186 E_FATAL(
"ERROR opening %s for reading\n", cepfile);
191 column = (vsize > dsize) ? dsize : vsize;
192 frm_end = (frm_end > noframe) ? noframe : frm_end;
194 E_INFO(
"Displaying %d out of %d columns per frame\n", column, vsize);
195 E_INFO(
"Total %d frames\n\n", noframe);
202 printf(
"\n%6s",
"frame#:");
205 for (j = 0; j < column; ++j) {
206 printf(
"%3s%3d%s ",
"c[", j,
"]");
211 offset += frm_begin * vsize;
212 for (i = frm_begin; i < frm_end; ++i) {
216 for (j = 0; j < column; ++j)
217 printf(
"%7.3f ", z[offset + j]);
231 read_cep(
char const *file,
float ***cep,
int *numframes,
int cepsize)
236 int i, n, byterev, sf, ef;
240 printf(
"stat(%s) failed\n", file);
244 if ((fp = fopen(file,
"rb")) == NULL) {
245 printf(
"Failed to open '%s' for reading: %s\n", file, strerror(errno));
250 if (fread(&n_float,
sizeof(
int), 1, fp) != 1) {
257 if ((
int) (n_float *
sizeof(
float) + 4) != statbuf.st_size) {
261 if ((
int) (n *
sizeof(
float) + 4) != statbuf.st_size) {
263 (
"Header size field: %d(%08x); filesize: %d(%08x)\n",
264 n_float, n_float, (
int) statbuf.st_size,
265 (
int) statbuf.st_size);
274 printf(
"Header size field: %d\n", n_float);
280 n = n_float / cepsize;
281 if (n * cepsize != n_float) {
282 printf(
"Header size field: %d; not multiple of %d\n",
290 mfcbuf = (
float **)
ckd_calloc_2d(n, cepsize,
sizeof(float32));
293 n_float = n * cepsize;
294 if ((
int) fread(mfcbuf[0],
sizeof(
float), n_float, fp) != n_float) {
295 printf(
"Error reading mfc data\n");
300 for (i = 0; i < n_float; i++)
301 SWAP_FLOAT32(&(mfcbuf[0][i]));
311 #if defined(_WIN32_WCE)
312 #pragma comment(linker,"/entry:mainWCRTStartup")
315 int wmain(int32 argc,
wchar_t *wargv[]) {
321 argv = malloc(argc*
sizeof(
char*));
322 for (i=0; i<argc; i++){
323 wlen = lstrlenW(wargv[i]);
324 len = wcstombs(NULL, wargv[i], wlen);
325 argv[i] = malloc(len+1);
326 wcstombs(argv[i], wargv[i], wlen);
330 return main(argc, argv);